[PR #6236] fix(checkpoint): handle metadata.writes when serializing old checkpoints with Jsonb #4923

Closed
opened 2026-02-20 17:50:57 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/6236

State: closed
Merged: Yes


Issue

Support for Checkpoint.metadata.writes was dropped in langgraph v0.5.x.

In langgraph-checkpoint-postgres v2.0.23, metadata was serialized with BasePostgresSaver._dump_metadata -> JsonPlusSerializer.dumps which handles pydantic.BaseModel.

In v2.0.23, metadata is serialized with psycopg.types.json.Jsonb, which raises TypeError: Object of type AIMessage is not JSON serializable when trying to serialize writes.

Solution

  • Add BaseCheckpointSaver.get_serializable_checkpoint_metadata which pops the writes key.
  • Log deprecation warning when strange version combinations are used

Solves https://github.com/langchain-ai/langgraph/issues/5769

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6236 **State:** closed **Merged:** Yes --- Issue Support for `Checkpoint.metadata.writes` was dropped in `langgraph` v0.5.x. In `langgraph-checkpoint-postgres` v2.0.23, metadata was serialized with `BasePostgresSaver._dump_metadata` -> `JsonPlusSerializer.dumps` which handles `pydantic.BaseModel`. In v2.0.23, metadata is serialized with `psycopg.types.json.Jsonb`, which raises `TypeError: Object of type AIMessage is not JSON serializable` when trying to serialize `writes`. Solution - Add `BaseCheckpointSaver.get_serializable_checkpoint_metadata` which pops the `writes` key. - Log deprecation warning when strange version combinations are used Solves https://github.com/langchain-ai/langgraph/issues/5769
yindo added the pull-request label 2026-02-20 17:50:57 -05:00
yindo closed this issue 2026-02-20 17:50:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4923