langchain-ai/langgraph · error · TypeError
Object of type is not serializable
Error message
Object of type {obj.__class__.__name__} is not serializable What it means
Terminal guard in JsonPlusSerializer's msgpack encoder (_msgpack_default): while packing a checkpoint value, an object was reached that has none of the supported special-case handlers (bytes/bytearray, datetime/date/time/timedelta, UUID, Enum, numpy scalar/array, dataclasses with to_json, sets, Counter, maps, AgentChatMessage, etc.). The object's type name is included in the message.
Solutions
- Keep checkpoint/state values to JSON-friendly primitives (dict, list, str, int, float, bool, None)
- Convert custom objects to dicts before storing them in state, and reconstruct them after loading
- If the type is genuinely needed and trusted, enable pickle fallback on the serializer (pickle_fallback=True)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py:534 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26).
Data as JSON: /api/errors/ec89b3fe92636a50.
Report an issue: GitHub.
Appendix: source
Thrown at libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py:534
obj, np_mod.ndarray
):
order = "F" if obj.flags.f_contiguous and not obj.flags.c_contiguous else "C"
if obj.flags.c_contiguous:
mv = memoryview(obj)
try:
meta = (obj.dtype.str, obj.shape, order, mv)
return ormsgpack.Ext(EXT_NUMPY_ARRAY, _msgpack_enc(meta))
finally:
mv.release()
else:
buf = obj.tobytes(order="A")
meta = (obj.dtype.str, obj.shape, order, buf)
return ormsgpack.Ext(EXT_NUMPY_ARRAY, _msgpack_enc(meta))
elif isinstance(obj, BaseException):
return repr(obj)
else:
raise TypeError(f"Object of type {obj.__class__.__name__} is not serializable")
def _send_from_args(args: Sequence[Any]) -> Any:
# ya we have a cyclic import here ¯\_(ツ)_/¯
from langgraph.types import Send # type: ignore
if len(args) == 2:
return Send(*args)
return Send(args[0], args[1], timeout=args[2])
def _create_msgpack_ext_hook(
allowed_modules: set[tuple[str, ...]] | Literal[True] | None,
) -> Callable[[int, bytes], Any]:
"""Create msgpack ext hook with allowlist.
Args:
allowed_modules: Set of (module, name) tuples that are allowed to beView on GitHub (pinned to 38031739e5)