ERROR: column cw.task_path does not exist in LangGraph Checkpoint Postgres >=2.0.12 (Creating an issue with a solution) #408

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

Originally created by @GhimBoon on GitHub (Jan 17, 2025).

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • 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

class ChatState(MessagesState):
    pass

async def chat_node(state: ChatState, *, config: Optional[RunnableConfig] = None) -> ChatState:
    system_message = ""
    llm  = call_llm()

    system_message = ("You are GPT-4o with training data up to Oct 2023.\n"
                       "You are a very careful thinker. Think step by step before answering.\n")

    messages = [SystemMessage(content=system_message)] + state["messages"]

    response = await llm.ainvoke(messages)
    return {"messages": [response]}


async def build_and_run_graph(message: str, config: RunnableConfig, run_method):
    connection_kwargs = {
        "autocommit": True,
        "prepare_threshold": 0,
    }
    print("Building Agent")
    async with AsyncConnectionPool(
            conninfo=PG_CONNECTIONSTRING,
            max_size=5,
            kwargs=connection_kwargs,
    ) as pool:
        checkpointer = AsyncPostgresSaver(pool)
        graph = await create_graph(config)
        compiled_graph = graph.compile(checkpointer=checkpointer)

        message_input = {"messages": [HumanMessage(content=message)]}

        return await run_method(compiled_graph, message_input, config)

async def stream_graph(compiled_graph, message_input, config):
    ui_message = cl.Message(content="")
    async for event in compiled_graph.astream_events(message_input, config=config, version="v1"):
        if event["event"] == "on_chat_model_stream" and event["name"] == "chatgpt":
            content = event["data"]["chunk"].content or ""
            await ui_message.stream_token(token=content)
    await ui_message.send()

async def run_agent(message: str, config: RunnableConfig = None):
    await build_and_run_graph(message, config, stream_graph)

async def create_graph(config: RunnableConfig):
    print("Initializing Graph")
    graph = StateGraph(ChatState)
    graph.add_node("chat", chat_node)
    graph.add_edge(START, "chat")
    graph.add_edge("chat", END)
    return graph

Error Message and Stack Trace (if applicable)

ERROR: column cw.task_path does not exist
LINE 27: ...array_agg(array[cw.type::bytea, cw.blob] order by cw.task_pa...
                                                              ^
Traceback (most recent call last):
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/chainlit/utils.py", line 45, in wrapper
    return await user_function(**params_values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/chainlit/callbacks.py", line 121, in with_parent_id
    await func(message)
  File "/mnt/c/Github/chainlit/app.py", line 193, in on_message
    await run_agent(message.content, config=config)
  File "/mnt/c/Github/chainlit/agent/run_graph.py", line 41, in run_agent
    await build_and_run_graph(message, config, stream_graph)
  File "/mnt/c/Github/chainlit/agent/run_graph.py", line 26, in build_and_run_graph
    return await run_method(compiled_graph, message_input, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Github/chainlit/agent/run_graph.py", line 30, in stream_graph
    async for event in compiled_graph.astream_events(message_input, config=config, version="v1"):
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langchain_core/runnables/base.py", line 1386, in astream_events
    async for event in event_stream:
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langchain_core/tracers/event_stream.py", line 781, in _astream_events_implementation_v1
    async for log in _astream_log_implementation(  # type: ignore[misc]
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langchain_core/tracers/log_stream.py", line 675, in _astream_log_implementation
    await task
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langchain_core/tracers/log_stream.py", line 629, in consume_astream
    async for chunk in runnable.astream(input, config, **kwargs):
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langgraph/pregel/__init__.py", line 1846, in astream
    async with AsyncPregelLoop(
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 1033, in __aenter__
    saved = await self.checkpointer.aget_tuple(self.checkpoint_config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langgraph/checkpoint/postgres/aio.py", line 186, in aget_tuple
    await cur.execute(
  File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/psycopg/cursor_async.py", line 97, in execute
    raise ex.with_traceback(None)
psycopg.errors.UndefinedColumn: column cw.task_path does not exist
LINE 27: ...array_agg(array[cw.type::bytea, cw.blob] order by cw.task_pa...

Description

LangGraph CheckPoint Postgres 2.0.12 and above is referencing a column that doesn't exist.

Solution is to ensure checkpointer.setup() is called to create the new column.

System Info

System Information
OS: Linux
OS Version: https://github.com/langchain-ai/langchain/pull/1 SMP Tue Nov 5 00:21:55 UTC 2024
Python Version: 3.12.0 | packaged by conda-forge | (main, Oct 3 2023, 08:43:22) [GCC 12.3.0]

Package Information
langchain_core: 0.3.29
langchain: 0.3.14
langchain_community: 0.3.14
langsmith: 0.2.10
langchain_openai: 0.3.0
langchain_postgres: 0.0.12
langchain_sdk: 0.1.5
langchain_text_splitters: 0.3.5
langchain_unstructured: 0.1.6
langgraph_sdk: 0.1.51

Optional packages not installed
langserve

Other Dependencies
aiohttp: 3.11.11
async-timeout: Installed. No version info available.
dataclasses-json: 0.6.7
httpx: 0.28.1
httpx-sse: 0.4.0
jsonpatch: 1.33
langchain_core>=0.3.0: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
numpy: 1.26.4
onnxruntime: 1.19.2
openai: 1.59.7
orjson: 3.10.14
packaging: 23.2
pgvector: 0.2.5
psycopg: 3.2.3
psycopg-pool: 3.2.4
pydantic: 2.9.2
pydantic-settings: 2.7.1
PyYAML: 6.0.2
requests: 2.32.3
requests-toolbelt: 1.0.0
SQLAlchemy: 2.0.37
sqlalchemy: 2.0.37
tenacity: 9.0.0
tiktoken: 0.8.0
typing-extensions: 4.12.2
unstructured-client: 0.27.0
unstructured[all-docs]: Installed. No version info available.
zstandard: Installed. No version info available.

Originally created by @GhimBoon on GitHub (Jan 17, 2025). ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use GitHub Discussions. - [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 class ChatState(MessagesState): pass async def chat_node(state: ChatState, *, config: Optional[RunnableConfig] = None) -> ChatState: system_message = "" llm = call_llm() system_message = ("You are GPT-4o with training data up to Oct 2023.\n" "You are a very careful thinker. Think step by step before answering.\n") messages = [SystemMessage(content=system_message)] + state["messages"] response = await llm.ainvoke(messages) return {"messages": [response]} async def build_and_run_graph(message: str, config: RunnableConfig, run_method): connection_kwargs = { "autocommit": True, "prepare_threshold": 0, } print("Building Agent") async with AsyncConnectionPool( conninfo=PG_CONNECTIONSTRING, max_size=5, kwargs=connection_kwargs, ) as pool: checkpointer = AsyncPostgresSaver(pool) graph = await create_graph(config) compiled_graph = graph.compile(checkpointer=checkpointer) message_input = {"messages": [HumanMessage(content=message)]} return await run_method(compiled_graph, message_input, config) async def stream_graph(compiled_graph, message_input, config): ui_message = cl.Message(content="") async for event in compiled_graph.astream_events(message_input, config=config, version="v1"): if event["event"] == "on_chat_model_stream" and event["name"] == "chatgpt": content = event["data"]["chunk"].content or "" await ui_message.stream_token(token=content) await ui_message.send() async def run_agent(message: str, config: RunnableConfig = None): await build_and_run_graph(message, config, stream_graph) async def create_graph(config: RunnableConfig): print("Initializing Graph") graph = StateGraph(ChatState) graph.add_node("chat", chat_node) graph.add_edge(START, "chat") graph.add_edge("chat", END) return graph ``` ### Error Message and Stack Trace (if applicable) ```shell ERROR: column cw.task_path does not exist LINE 27: ...array_agg(array[cw.type::bytea, cw.blob] order by cw.task_pa... ^ Traceback (most recent call last): File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/chainlit/utils.py", line 45, in wrapper return await user_function(**params_values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/chainlit/callbacks.py", line 121, in with_parent_id await func(message) File "/mnt/c/Github/chainlit/app.py", line 193, in on_message await run_agent(message.content, config=config) File "/mnt/c/Github/chainlit/agent/run_graph.py", line 41, in run_agent await build_and_run_graph(message, config, stream_graph) File "/mnt/c/Github/chainlit/agent/run_graph.py", line 26, in build_and_run_graph return await run_method(compiled_graph, message_input, config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/c/Github/chainlit/agent/run_graph.py", line 30, in stream_graph async for event in compiled_graph.astream_events(message_input, config=config, version="v1"): File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langchain_core/runnables/base.py", line 1386, in astream_events async for event in event_stream: File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langchain_core/tracers/event_stream.py", line 781, in _astream_events_implementation_v1 async for log in _astream_log_implementation( # type: ignore[misc] File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langchain_core/tracers/log_stream.py", line 675, in _astream_log_implementation await task File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langchain_core/tracers/log_stream.py", line 629, in consume_astream async for chunk in runnable.astream(input, config, **kwargs): File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langgraph/pregel/__init__.py", line 1846, in astream async with AsyncPregelLoop( File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 1033, in __aenter__ saved = await self.checkpointer.aget_tuple(self.checkpoint_config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/langgraph/checkpoint/postgres/aio.py", line 186, in aget_tuple await cur.execute( File "/home/ubuntu/miniforge3/envs/python3.12/lib/python3.12/site-packages/psycopg/cursor_async.py", line 97, in execute raise ex.with_traceback(None) psycopg.errors.UndefinedColumn: column cw.task_path does not exist LINE 27: ...array_agg(array[cw.type::bytea, cw.blob] order by cw.task_pa... ``` ### Description LangGraph CheckPoint Postgres 2.0.12 and above is referencing a column that doesn't exist. Solution is to ensure checkpointer.setup() is called to create the new column. ### System Info System Information OS: Linux OS Version: https://github.com/langchain-ai/langchain/pull/1 SMP Tue Nov 5 00:21:55 UTC 2024 Python Version: 3.12.0 | packaged by conda-forge | (main, Oct 3 2023, 08:43:22) [GCC 12.3.0] Package Information langchain_core: 0.3.29 langchain: 0.3.14 langchain_community: 0.3.14 langsmith: 0.2.10 langchain_openai: 0.3.0 langchain_postgres: 0.0.12 langchain_sdk: 0.1.5 langchain_text_splitters: 0.3.5 langchain_unstructured: 0.1.6 langgraph_sdk: 0.1.51 Optional packages not installed langserve Other Dependencies aiohttp: 3.11.11 async-timeout: Installed. No version info available. dataclasses-json: 0.6.7 httpx: 0.28.1 httpx-sse: 0.4.0 jsonpatch: 1.33 langchain_core>=0.3.0: Installed. No version info available. langsmith-pyo3: Installed. No version info available. numpy: 1.26.4 onnxruntime: 1.19.2 openai: 1.59.7 orjson: 3.10.14 packaging: 23.2 pgvector: 0.2.5 psycopg: 3.2.3 psycopg-pool: 3.2.4 pydantic: 2.9.2 pydantic-settings: 2.7.1 PyYAML: 6.0.2 requests: 2.32.3 requests-toolbelt: 1.0.0 SQLAlchemy: 2.0.37 sqlalchemy: 2.0.37 tenacity: 9.0.0 tiktoken: 0.8.0 typing-extensions: 4.12.2 unstructured-client: 0.27.0 unstructured[all-docs]: Installed. No version info available. zstandard: Installed. No version info available.
yindo closed this issue 2026-02-20 17:39:58 -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#408