Menu

LangGraph AsyncPostgresSaver: fixing 'psycopg.OperationalError: the connection is closed' in FastAPI
📰

LangGraph AsyncPostgresSaver: fixing 'psycopg.OperationalError: the connection is closed' in FastAPI

DEV Community: fastapi·Mohammed Rafay·18 days ago
#h4CX2m5d
Reading 0:00
15s threshold

Disclosure: I work on MemorySync (I'm Mohammed, the founder). I drafted this page with AI assistance and checked it against the source issue and the official docs listed under Sources on Oct 28, 2026. I read the code and docs; I didn't run this FastAPI app for this page.

The question

In langchain-ai/langgraph#1292 , "Encountering OperationalError with Postgres Checkpointer in LangGraph" (Aug 9, 2024), the Postgres checkpointer failed with:

psycopg.OperationalError: the connection is closed

Enter fullscreen mode

Exit fullscreen mode

The graph was compiled inside a function like this:

async with AsyncPostgresSaver . from_conn_string ( os . environ . get ( " POSTGRES_CONN_STRING " )) as checkpointer : return workflow . compile ( checkpointer = checkpointer , interrupt_before = [ AgentRole .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.