Langgraph postgresql checkpointer support old checkpoints #973

Closed
opened 2026-02-20 17:42:35 -05:00 by yindo · 2 comments
Owner

Originally created by @razmikmelikbekyan on GitHub (Sep 12, 2025).

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

here:


def _load_checkpoint_tuple(self, value: DictRow) -> CheckpointTuple:
        """
        Convert a database row into a CheckpointTuple object.

        Args:
            value: A row from the database containing checkpoint data.

        Returns:
            CheckpointTuple: A structured representation of the checkpoint,
            including its configuration, metadata, parent checkpoint (if any),
            and pending writes.
        """
        return CheckpointTuple(
            {
                "configurable": {
                    "thread_id": value["thread_id"],
                    "checkpoint_ns": value["checkpoint_ns"],
                    "checkpoint_id": value["checkpoint_id"],
                }
            },
            {
                **value["checkpoint"],
                "channel_values": {
                    **value["checkpoint"].get("channel_values"),
                    **self._load_blobs(value["channel_values"]),
                },
            },
            value["metadata"],
            (
                {
                    "configurable": {
                        "thread_id": value["thread_id"],
                        "checkpoint_ns": value["checkpoint_ns"],
                        "checkpoint_id": value["parent_checkpoint_id"],
                    }
                }
                if value["parent_checkpoint_id"]
                else None
            ),
            self._load_writes(value["pending_writes"]),
        )


this line `**value["checkpoint"].get("channel_values"), should be replaced by this

`**value["checkpoint"].get("channel_values", {}),`

to avoid issue when old checkpoint does not have `channel_values` key.

Error Message and Stack Trace (if applicable)

File "/Users/rmelikbe/Desktop/projects/diva-backend/venv/lib/python3.11/site-packages/langgraph/checkpoint/base/__init__.py", line 149, in get
    if value := self.get_tuple(config):
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rmelikbe/Desktop/projects/diva-backend/venv/lib/python3.11/site-packages/langgraph/checkpoint/postgres/__init__.py", line 250, in get_tuple
    return self._load_checkpoint_tuple(value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rmelikbe/Desktop/projects/diva-backend/venv/lib/python3.11/site-packages/langgraph/checkpoint/postgres/__init__.py", line 455, in _load_checkpoint_tuple
    "channel_values": {
                      ^
TypeError: 'NoneType' object is not a mapping

Description

in case you have already a database with checkpoints with older langgraph versions it is causing an issue

System Info

"langgraph==0.6.6",

"langgraph-checkpoint-postgres==2.0.23",

Originally created by @razmikmelikbekyan on GitHub (Sep 12, 2025). ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/). - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code ```python here: def _load_checkpoint_tuple(self, value: DictRow) -> CheckpointTuple: """ Convert a database row into a CheckpointTuple object. Args: value: A row from the database containing checkpoint data. Returns: CheckpointTuple: A structured representation of the checkpoint, including its configuration, metadata, parent checkpoint (if any), and pending writes. """ return CheckpointTuple( { "configurable": { "thread_id": value["thread_id"], "checkpoint_ns": value["checkpoint_ns"], "checkpoint_id": value["checkpoint_id"], } }, { **value["checkpoint"], "channel_values": { **value["checkpoint"].get("channel_values"), **self._load_blobs(value["channel_values"]), }, }, value["metadata"], ( { "configurable": { "thread_id": value["thread_id"], "checkpoint_ns": value["checkpoint_ns"], "checkpoint_id": value["parent_checkpoint_id"], } } if value["parent_checkpoint_id"] else None ), self._load_writes(value["pending_writes"]), ) this line `**value["checkpoint"].get("channel_values"), should be replaced by this `**value["checkpoint"].get("channel_values", {}),` to avoid issue when old checkpoint does not have `channel_values` key. ``` ### Error Message and Stack Trace (if applicable) ```shell File "/Users/rmelikbe/Desktop/projects/diva-backend/venv/lib/python3.11/site-packages/langgraph/checkpoint/base/__init__.py", line 149, in get if value := self.get_tuple(config): ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/rmelikbe/Desktop/projects/diva-backend/venv/lib/python3.11/site-packages/langgraph/checkpoint/postgres/__init__.py", line 250, in get_tuple return self._load_checkpoint_tuple(value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/rmelikbe/Desktop/projects/diva-backend/venv/lib/python3.11/site-packages/langgraph/checkpoint/postgres/__init__.py", line 455, in _load_checkpoint_tuple "channel_values": { ^ TypeError: 'NoneType' object is not a mapping ``` ### Description in case you have already a database with checkpoints with older langgraph versions it is causing an issue ### System Info "langgraph==0.6.6", "langgraph-checkpoint-postgres==2.0.23",
yindo added the bugpending labels 2026-02-20 17:42:35 -05:00
yindo closed this issue 2026-02-20 17:42:35 -05:00
Author
Owner

@juyterman1000 commented on GitHub (Sep 14, 2025):

The issue is fixed

@juyterman1000 commented on GitHub (Sep 14, 2025): The issue is fixed
Author
Owner

@casparb commented on GitHub (Sep 17, 2025):

Hi @razmikmelikbekyan, thanks for flagging this. Fixed in #6162

@casparb commented on GitHub (Sep 17, 2025): Hi @razmikmelikbekyan, thanks for flagging this. Fixed in #6162
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#973