Skip to content

msgpack serializer fails on pathlib.PurePath and range objects #8350

Description

Checked other resources

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Related Issues / PRs

#8345

Reproduction Steps / Example Code (Python)

import pathlib
from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer

s = JsonPlusSerializer()

# Fails: PurePosixPath is a PurePath but not a Path
p = pathlib.PurePosixPath("/foo/bar")
s.dumps(p)

# Fails: range has no serializer
r = range(0, 10, 2)
s.dumps(r)

Error Message and Stack Trace (if applicable)

Description

  • I'm using LangGraph's msgpack checkpointer to serialize state.
  • I expect pathlib.PurePath subclasses (PurePosixPath, PureWindowsPath) and range objects to serialize/deserialize correctly.
  • Instead, they raise a serialization error. PurePath subclasses are missed because the check uses pathlib.Path instead of pathlib.PurePath. range objects have no serialization support at all.

System Info

langgraph latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternal

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions