Getting error while executing a subgraph from a node and interrupt is called in the subgraph #537

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

Originally created by @dinesh1301 on GitHub (Mar 26, 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

test.py

from typing import TypedDict

from langgraph.constants import START, END
from langgraph.errors import GraphInterrupt
from langgraph.graph import StateGraph
from langgraph.types import interrupt, Command

from utils import get_new_thread_id, get_remote_graph


class SubNodeData(TypedDict):
    test: True

def subnode1(state: SubNodeData):
    print("subnode 1 called initially")
    interrupt_data = {
        "test": True
    }
    result = interrupt(interrupt_data)
    print("subnode 1 called after interrupt")
    return state

def build_subgrapph(state: dict):
    workflow = StateGraph(SubNodeData)
    workflow.add_node("subnode1", subnode1)
    workflow.add_edge(START, "subnode1")
    workflow.add_edge("subnode1", END)
    return workflow.compile()


class MainNodeData(TypedDict):
    test: True

def main_graph_node(state: MainNodeData):
    print("main graph node called")
    return state

def subgraph_caller(state: MainNodeData) -> MainNodeData:
    g = get_remote_graph("subagent")
    thread_id = get_new_thread_id()
    g.invoke({"test": True}, config={"configurable": {"thread_id": thread_id}})
    return state

def build_main_graph():
    workflow = StateGraph(MainNodeData)
    workflow.add_node("subgraph", subgraph_caller)
    workflow.add_node("main_node", main_graph_node)
    workflow.add_edge(START, "main_node")
    workflow.add_edge("main_node", "subgraph")
    workflow.add_edge("subgraph", END)
    return workflow.compile()

if __name__ == "__main__":
    g = get_remote_graph("main_agent")
    thread_id = get_new_thread_id()
    print(f"Thread id: {thread_id}")
    try:
        g.invoke({"test": True})
    except GraphInterrupt as e:
        print(e)
        config = {"configurable": {"thread_id": thread_id}}
        g.invoke(Command(resume={"thread_id": thread_id}), config=config)


langgraph.json


{
    "dependencies": [
        "./test"


    ],
    "graphs": {
        "main_agent": "./test/test.py:build_main_graph",
        "subagent": "./test/test.py:build_subgrapph"
    }
}


langgraph-util


import os

from langgraph_sdk import get_client, get_sync_client
from langgraph.pregel.remote import RemoteGraph


def get_api_key():
    return os.getenv("LANGSMITH_API_KEY")


def get_url():
    return "http://127.0.0.1:2024"
    


def get_langgraph_sync_client():
    return get_sync_client(url=get_url(), api_key=get_api_key())


def get_langgraph_client():
    client = get_client(url=get_url(), api_key=get_api_key())
    return client, get_langgraph_sync_client()


def get_remote_graph(graph_name: str):
    return RemoteGraph(graph_name, url=get_url())


def get_new_thread_id():
    client = get_langgraph_sync_client()
    thread = client.threads.create()
    return thread["thread_id"]

Error Message and Stack Trace (if applicable)

The error in console

Thread id: 44e5a28a-5349-474f-b41a-9849719e6c71
Traceback (most recent call last):
  File "/Users/dineshsingh/dev/topmate/test-subgraph/test/test.py", line 58, in <module>
    g.invoke({"test": True})
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/remote.py", line 808, in invoke
    for chunk in self.stream(
                 ^^^^^^^^^^^^
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/remote.py", line 659, in stream
    raise RemoteException(chunk.data)
langgraph.pregel.remote.RemoteException: {'error': 'TypeError', 'message': 'asdict() should be called on dataclass instances'}

Process finished with exit code 1


logs


main graph node called
2025-03-26T10:39:55.547068Z [info     ] HTTP Request: POST http://127.0.0.1:2024/threads "HTTP/1.1 200 OK" [httpx] api_variant=local_dev thread_name=asyncio_1
2025-03-26T10:39:55.547319Z [info     ] POST /threads 200 0ms          [langgraph_api.server] api_variant=local_dev latency_ms=0 method=POST path=/threads path_params={} proto=1.1 query_string= req_header={'host': '127.0.0.1:2024', 'accept': '*/*', 'accept-encoding': 'gzip, deflate, zstd', 'connection': 'keep-alive', 'user-agent': 'langgraph-sdk-py/0.1.58', 'content-length': '2', 'content-type': 'application/json'} res_header={'content-length': '204', 'content-type': 'application/json'} route=/threads status=200 thread_name=asyncio_0
2025-03-26T10:39:55.549475Z [info     ] Created run                    [langgraph_storage.ops] api_variant=local_dev run_id=1f00a2ea-837d-6df4-8ed5-de50373bf2dc thread_id=59d9db7d-db84-487b-bfe5-08adc4235933 thread_name=MainThread
2025-03-26T10:39:55.550963Z [info     ] HTTP Request: POST http://127.0.0.1:2024/threads/59d9db7d-db84-487b-bfe5-08adc4235933/runs/stream "HTTP/1.1 200 OK" [httpx] api_variant=local_dev thread_name=asyncio_1
2025-03-26T10:39:56.505064Z [info     ] Starting background run        [langgraph_api.worker] api_variant=local_dev run_attempt=1 run_created_at=2025-03-26T10:39:55.549452+00:00 run_id=1f00a2ea-837d-6df4-8ed5-de50373bf2dc run_queue_ms=955 run_started_at=2025-03-26T10:39:56.504847+00:00 thread_name=asyncio_0
subnode 1 called initially
2025-03-26T10:39:56.511934Z [info     ] Background run succeeded       [langgraph_api.worker] api_variant=local_dev run_attempt=1 run_created_at=2025-03-26T10:39:55.549452+00:00 run_ended_at=2025-03-26T10:39:56.511783+00:00 run_exec_ms=6 run_id=1f00a2ea-837d-6df4-8ed5-de50373bf2dc run_started_at=2025-03-26T10:39:56.504847+00:00 thread_name=asyncio_0
2025-03-26T10:39:56.512273Z [info     ] POST /threads/59d9db7d-db84-487b-bfe5-08adc4235933/runs/stream 200 963ms [langgraph_api.server] api_variant=local_dev latency_ms=963 method=POST path=/threads/59d9db7d-db84-487b-bfe5-08adc4235933/runs/stream path_params={'thread_id': '59d9db7d-db84-487b-bfe5-08adc4235933'} proto=1.1 query_string= req_header={'host': '127.0.0.1:2024', 'accept': '*/*', 'accept-encoding': 'gzip, deflate, zstd', 'connection': 'keep-alive', 'user-agent': 'langgraph-sdk-py/0.1.58', 'content-length': '237', 'content-type': 'application/json'} res_header={'location': '/threads/59d9db7d-db84-487b-bfe5-08adc4235933/runs/1f00a2ea-837d-6df4-8ed5-de50373bf2dc/stream', 'cache-control': 'no-store', 'connection': 'keep-alive', 'x-accel-buffering': 'no', 'content-type': 'text/event-stream; charset=utf-8'} route=/threads/{thread_id}/runs/stream status=200 thread_name=asyncio_1
2025-03-26T10:39:56.514847Z [info     ] POST /runs/stream 200 1762ms   [langgraph_api.server] api_variant=local_dev latency_ms=1762 method=POST path=/runs/stream path_params={} proto=1.1 query_string= req_header={'host': '127.0.0.1:2024', 'accept': '*/*', 'accept-encoding': 'gzip, deflate, zstd', 'connection': 'keep-alive', 'user-agent': 'langgraph-sdk-py/0.1.58', 'content-length': '189', 'content-type': 'application/json'} res_header={'location': '/threads/b2b3d02c-715b-4ac3-85a4-8d1d4e581167/runs/1f00a2ea-7be4-66a6-a078-e89b310c7603/stream', 'cache-control': 'no-store', 'connection': 'keep-alive', 'x-accel-buffering': 'no', 'content-type': 'text/event-stream; charset=utf-8'} route=/runs/stream status=200 thread_name=asyncio_2
2025-03-26T10:39:56.513067Z [error    ] Background run failed          [langgraph_api.worker] api_variant=local_dev run_attempt=1 run_created_at=2025-03-26T10:39:54.752956+00:00 run_ended_at=2025-03-26T10:39:56.513011+00:00 run_exec_ms=1010 run_id=1f00a2ea-7be4-66a6-a078-e89b310c7603 run_started_at=2025-03-26T10:39:55.502821+00:00 thread_name=asyncio_1
Traceback (most recent call last):
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/worker.py", line 128, in worker
    await asyncio.wait_for(consume(stream, run_id), BG_JOB_TIMEOUT_SECS)
  File "/opt/homebrew/Cellar/python@3.12/3.12.9/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/stream.py", line 267, in consume
    raise e from None
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/stream.py", line 257, in consume
    async for mode, payload in stream:
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/stream.py", line 208, in astream_state
    event = await wait_if_not_done(anext(stream, sentinel), done)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/asyncio.py", line 72, in wait_if_not_done
    raise e.exceptions[0] from None
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/__init__.py", line 2607, in astream
    async for _ in runner.atick(
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/runner.py", line 279, in atick
    self.commit(t, exc)
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/runner.py", line 383, in commit
    self.put_writes()(task.id, writes)  # type: ignore[misc]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 341, in put_writes
    self._output_writes(task_id, writes)
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 860, in _output_writes
    self._emit(
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 822, in _emit
    for v in values(*args, **kwargs):
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/debug.py", line 141, in map_debug_task_results
    asdict(v)
  File "/opt/homebrew/Cellar/python@3.12/3.12.9/Frameworks/Python.framework/Versions/3.12/lib/python3.12/dataclasses.py", line 1328, in asdict
    raise TypeError("asdict() should be called on dataclass instances")
TypeError: asdict() should be called on dataclass instances

Description

I am getting this weird error.

langgraph.pregel.remote.RemoteException: {'error': 'TypeError', 'message': 'asdict() should be called on dataclass instances'}

Conditions:

I am running graphs(both main and subgraph) on a local server. Subgraph is direct a part of the main graph, it is being executed via a node in the main graph.
The subgraph calls the interrupt. I am not catching the GraphInterrupt in the main graph however, I am catching it from the place I am executing the main graph.

The error

Getting

langgraph.pregel.remote.RemoteException: {'error': 'TypeError', 'message': 'asdict() should be called on dataclass instances'}

I even tried passing dataclass in the interrupt, but even that didn't work. Wanted to know what exactly is the issue.

Also, is there a basic level flaw in the architecture which is creating this issue, if yes, then can someone please explain.

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 24.4.0: Sat Feb 15 22:50:54 PST 2025; root:xnu-11417.100.533.501.4~3/RELEASE_ARM64_T6000
Python Version: 3.12.9 (main, Feb 4 2025, 14:38:38) [Clang 16.0.0 (clang-1600.0.26.6)]

Package Information

langchain_core: 0.3.47
langsmith: 0.3.18
langchain_openai: 0.3.9
langgraph_api: 0.0.32
langgraph_cli: 0.1.79
langgraph_license: Installed. No version info available.
langgraph_sdk: 0.1.58
langgraph_storage: Installed. No version info available.

Optional packages not installed

langserve

Other Dependencies

click: 8.1.8
cryptography: 43.0.3
httpx: 0.28.1
jsonpatch<2.0,>=1.33: Installed. No version info available.
jsonschema-rs: 0.29.1
langchain-core<1.0.0,>=0.3.45: Installed. No version info available.
langgraph: 0.3.18
langgraph-checkpoint: 2.0.23
langsmith-pyo3: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
openai-agents: Installed. No version info available.
openai<2.0.0,>=1.66.3: Installed. No version info available.
opentelemetry-api: Installed. No version info available.
opentelemetry-exporter-otlp-proto-http: Installed. No version info available.
opentelemetry-sdk: Installed. No version info available.
orjson: 3.10.15
packaging: 24.2
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.10.6
pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
pyjwt: 2.10.1
pytest: Installed. No version info available.
python-dotenv: 1.0.1
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.3
requests-toolbelt: 1.0.0
rich: Installed. No version info available.
sse-starlette: 2.1.3
starlette: 0.46.1
structlog: 25.2.0
tenacity: 9.0.0
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken<1,>=0.7: Installed. No version info available.
typing-extensions>=4.7: Installed. No version info available.
uvicorn: 0.34.0
watchfiles: 1.0.4
zstandard: 0.23.0

Originally created by @dinesh1301 on GitHub (Mar 26, 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 test.py from typing import TypedDict from langgraph.constants import START, END from langgraph.errors import GraphInterrupt from langgraph.graph import StateGraph from langgraph.types import interrupt, Command from utils import get_new_thread_id, get_remote_graph class SubNodeData(TypedDict): test: True def subnode1(state: SubNodeData): print("subnode 1 called initially") interrupt_data = { "test": True } result = interrupt(interrupt_data) print("subnode 1 called after interrupt") return state def build_subgrapph(state: dict): workflow = StateGraph(SubNodeData) workflow.add_node("subnode1", subnode1) workflow.add_edge(START, "subnode1") workflow.add_edge("subnode1", END) return workflow.compile() class MainNodeData(TypedDict): test: True def main_graph_node(state: MainNodeData): print("main graph node called") return state def subgraph_caller(state: MainNodeData) -> MainNodeData: g = get_remote_graph("subagent") thread_id = get_new_thread_id() g.invoke({"test": True}, config={"configurable": {"thread_id": thread_id}}) return state def build_main_graph(): workflow = StateGraph(MainNodeData) workflow.add_node("subgraph", subgraph_caller) workflow.add_node("main_node", main_graph_node) workflow.add_edge(START, "main_node") workflow.add_edge("main_node", "subgraph") workflow.add_edge("subgraph", END) return workflow.compile() if __name__ == "__main__": g = get_remote_graph("main_agent") thread_id = get_new_thread_id() print(f"Thread id: {thread_id}") try: g.invoke({"test": True}) except GraphInterrupt as e: print(e) config = {"configurable": {"thread_id": thread_id}} g.invoke(Command(resume={"thread_id": thread_id}), config=config) langgraph.json { "dependencies": [ "./test" ], "graphs": { "main_agent": "./test/test.py:build_main_graph", "subagent": "./test/test.py:build_subgrapph" } } langgraph-util import os from langgraph_sdk import get_client, get_sync_client from langgraph.pregel.remote import RemoteGraph def get_api_key(): return os.getenv("LANGSMITH_API_KEY") def get_url(): return "http://127.0.0.1:2024" def get_langgraph_sync_client(): return get_sync_client(url=get_url(), api_key=get_api_key()) def get_langgraph_client(): client = get_client(url=get_url(), api_key=get_api_key()) return client, get_langgraph_sync_client() def get_remote_graph(graph_name: str): return RemoteGraph(graph_name, url=get_url()) def get_new_thread_id(): client = get_langgraph_sync_client() thread = client.threads.create() return thread["thread_id"] ``` ### Error Message and Stack Trace (if applicable) ```shell The error in console Thread id: 44e5a28a-5349-474f-b41a-9849719e6c71 Traceback (most recent call last): File "/Users/dineshsingh/dev/topmate/test-subgraph/test/test.py", line 58, in <module> g.invoke({"test": True}) File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/remote.py", line 808, in invoke for chunk in self.stream( ^^^^^^^^^^^^ File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/remote.py", line 659, in stream raise RemoteException(chunk.data) langgraph.pregel.remote.RemoteException: {'error': 'TypeError', 'message': 'asdict() should be called on dataclass instances'} Process finished with exit code 1 logs main graph node called 2025-03-26T10:39:55.547068Z [info ] HTTP Request: POST http://127.0.0.1:2024/threads "HTTP/1.1 200 OK" [httpx] api_variant=local_dev thread_name=asyncio_1 2025-03-26T10:39:55.547319Z [info ] POST /threads 200 0ms [langgraph_api.server] api_variant=local_dev latency_ms=0 method=POST path=/threads path_params={} proto=1.1 query_string= req_header={'host': '127.0.0.1:2024', 'accept': '*/*', 'accept-encoding': 'gzip, deflate, zstd', 'connection': 'keep-alive', 'user-agent': 'langgraph-sdk-py/0.1.58', 'content-length': '2', 'content-type': 'application/json'} res_header={'content-length': '204', 'content-type': 'application/json'} route=/threads status=200 thread_name=asyncio_0 2025-03-26T10:39:55.549475Z [info ] Created run [langgraph_storage.ops] api_variant=local_dev run_id=1f00a2ea-837d-6df4-8ed5-de50373bf2dc thread_id=59d9db7d-db84-487b-bfe5-08adc4235933 thread_name=MainThread 2025-03-26T10:39:55.550963Z [info ] HTTP Request: POST http://127.0.0.1:2024/threads/59d9db7d-db84-487b-bfe5-08adc4235933/runs/stream "HTTP/1.1 200 OK" [httpx] api_variant=local_dev thread_name=asyncio_1 2025-03-26T10:39:56.505064Z [info ] Starting background run [langgraph_api.worker] api_variant=local_dev run_attempt=1 run_created_at=2025-03-26T10:39:55.549452+00:00 run_id=1f00a2ea-837d-6df4-8ed5-de50373bf2dc run_queue_ms=955 run_started_at=2025-03-26T10:39:56.504847+00:00 thread_name=asyncio_0 subnode 1 called initially 2025-03-26T10:39:56.511934Z [info ] Background run succeeded [langgraph_api.worker] api_variant=local_dev run_attempt=1 run_created_at=2025-03-26T10:39:55.549452+00:00 run_ended_at=2025-03-26T10:39:56.511783+00:00 run_exec_ms=6 run_id=1f00a2ea-837d-6df4-8ed5-de50373bf2dc run_started_at=2025-03-26T10:39:56.504847+00:00 thread_name=asyncio_0 2025-03-26T10:39:56.512273Z [info ] POST /threads/59d9db7d-db84-487b-bfe5-08adc4235933/runs/stream 200 963ms [langgraph_api.server] api_variant=local_dev latency_ms=963 method=POST path=/threads/59d9db7d-db84-487b-bfe5-08adc4235933/runs/stream path_params={'thread_id': '59d9db7d-db84-487b-bfe5-08adc4235933'} proto=1.1 query_string= req_header={'host': '127.0.0.1:2024', 'accept': '*/*', 'accept-encoding': 'gzip, deflate, zstd', 'connection': 'keep-alive', 'user-agent': 'langgraph-sdk-py/0.1.58', 'content-length': '237', 'content-type': 'application/json'} res_header={'location': '/threads/59d9db7d-db84-487b-bfe5-08adc4235933/runs/1f00a2ea-837d-6df4-8ed5-de50373bf2dc/stream', 'cache-control': 'no-store', 'connection': 'keep-alive', 'x-accel-buffering': 'no', 'content-type': 'text/event-stream; charset=utf-8'} route=/threads/{thread_id}/runs/stream status=200 thread_name=asyncio_1 2025-03-26T10:39:56.514847Z [info ] POST /runs/stream 200 1762ms [langgraph_api.server] api_variant=local_dev latency_ms=1762 method=POST path=/runs/stream path_params={} proto=1.1 query_string= req_header={'host': '127.0.0.1:2024', 'accept': '*/*', 'accept-encoding': 'gzip, deflate, zstd', 'connection': 'keep-alive', 'user-agent': 'langgraph-sdk-py/0.1.58', 'content-length': '189', 'content-type': 'application/json'} res_header={'location': '/threads/b2b3d02c-715b-4ac3-85a4-8d1d4e581167/runs/1f00a2ea-7be4-66a6-a078-e89b310c7603/stream', 'cache-control': 'no-store', 'connection': 'keep-alive', 'x-accel-buffering': 'no', 'content-type': 'text/event-stream; charset=utf-8'} route=/runs/stream status=200 thread_name=asyncio_2 2025-03-26T10:39:56.513067Z [error ] Background run failed [langgraph_api.worker] api_variant=local_dev run_attempt=1 run_created_at=2025-03-26T10:39:54.752956+00:00 run_ended_at=2025-03-26T10:39:56.513011+00:00 run_exec_ms=1010 run_id=1f00a2ea-7be4-66a6-a078-e89b310c7603 run_started_at=2025-03-26T10:39:55.502821+00:00 thread_name=asyncio_1 Traceback (most recent call last): File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/worker.py", line 128, in worker await asyncio.wait_for(consume(stream, run_id), BG_JOB_TIMEOUT_SECS) File "/opt/homebrew/Cellar/python@3.12/3.12.9/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/tasks.py", line 520, in wait_for return await fut ^^^^^^^^^ File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/stream.py", line 267, in consume raise e from None File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/stream.py", line 257, in consume async for mode, payload in stream: File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/stream.py", line 208, in astream_state event = await wait_if_not_done(anext(stream, sentinel), done) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph_api/asyncio.py", line 72, in wait_if_not_done raise e.exceptions[0] from None File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/__init__.py", line 2607, in astream async for _ in runner.atick( File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/runner.py", line 279, in atick self.commit(t, exc) File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/runner.py", line 383, in commit self.put_writes()(task.id, writes) # type: ignore[misc] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 341, in put_writes self._output_writes(task_id, writes) File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 860, in _output_writes self._emit( File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 822, in _emit for v in values(*args, **kwargs): ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dineshsingh/dev/topmate/test-subgraph/venv/lib/python3.12/site-packages/langgraph/pregel/debug.py", line 141, in map_debug_task_results asdict(v) File "/opt/homebrew/Cellar/python@3.12/3.12.9/Frameworks/Python.framework/Versions/3.12/lib/python3.12/dataclasses.py", line 1328, in asdict raise TypeError("asdict() should be called on dataclass instances") TypeError: asdict() should be called on dataclass instances ``` ### Description I am getting this weird error. ``` langgraph.pregel.remote.RemoteException: {'error': 'TypeError', 'message': 'asdict() should be called on dataclass instances'} ``` ## Conditions: I am running graphs(both main and subgraph) on a local server. Subgraph is direct a part of the main graph, it is being executed via a node in the main graph. The subgraph calls the interrupt. I am not catching the `GraphInterrupt` in the main graph however, I am catching it from the place I am executing the main graph. ## The error Getting ``` langgraph.pregel.remote.RemoteException: {'error': 'TypeError', 'message': 'asdict() should be called on dataclass instances'} ``` I even tried passing dataclass in the interrupt, but even that didn't work. Wanted to know what exactly is the issue. Also, is there a basic level flaw in the architecture which is creating this issue, if yes, then can someone please explain. ### System Info System Information ------------------ > OS: Darwin > OS Version: Darwin Kernel Version 24.4.0: Sat Feb 15 22:50:54 PST 2025; root:xnu-11417.100.533.501.4~3/RELEASE_ARM64_T6000 > Python Version: 3.12.9 (main, Feb 4 2025, 14:38:38) [Clang 16.0.0 (clang-1600.0.26.6)] Package Information ------------------- > langchain_core: 0.3.47 > langsmith: 0.3.18 > langchain_openai: 0.3.9 > langgraph_api: 0.0.32 > langgraph_cli: 0.1.79 > langgraph_license: Installed. No version info available. > langgraph_sdk: 0.1.58 > langgraph_storage: Installed. No version info available. Optional packages not installed ------------------------------- > langserve Other Dependencies ------------------ > click: 8.1.8 > cryptography: 43.0.3 > httpx: 0.28.1 > jsonpatch<2.0,>=1.33: Installed. No version info available. > jsonschema-rs: 0.29.1 > langchain-core<1.0.0,>=0.3.45: Installed. No version info available. > langgraph: 0.3.18 > langgraph-checkpoint: 2.0.23 > langsmith-pyo3: Installed. No version info available. > langsmith<0.4,>=0.1.125: Installed. No version info available. > openai-agents: Installed. No version info available. > openai<2.0.0,>=1.66.3: Installed. No version info available. > opentelemetry-api: Installed. No version info available. > opentelemetry-exporter-otlp-proto-http: Installed. No version info available. > opentelemetry-sdk: Installed. No version info available. > orjson: 3.10.15 > packaging: 24.2 > packaging<25,>=23.2: Installed. No version info available. > pydantic: 2.10.6 > pydantic<3.0.0,>=2.5.2;: Installed. No version info available. > pydantic<3.0.0,>=2.7.4;: Installed. No version info available. > pyjwt: 2.10.1 > pytest: Installed. No version info available. > python-dotenv: 1.0.1 > PyYAML>=5.3: Installed. No version info available. > requests: 2.32.3 > requests-toolbelt: 1.0.0 > rich: Installed. No version info available. > sse-starlette: 2.1.3 > starlette: 0.46.1 > structlog: 25.2.0 > tenacity: 9.0.0 > tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available. > tiktoken<1,>=0.7: Installed. No version info available. > typing-extensions>=4.7: Installed. No version info available. > uvicorn: 0.34.0 > watchfiles: 1.0.4 > zstandard: 0.23.0
yindo closed this issue 2026-02-20 17:40:37 -05:00
Author
Owner

@vbarda commented on GitHub (Mar 26, 2025):

@dinesh1301 thanks for reporting - fixed here https://github.com/langchain-ai/langgraph/pull/4040 and will release shortly

@vbarda commented on GitHub (Mar 26, 2025): @dinesh1301 thanks for reporting - fixed here https://github.com/langchain-ai/langgraph/pull/4040 and will release shortly
Author
Owner

@vbarda commented on GitHub (Mar 27, 2025):

This is fixed in langgraph==0.3.21

@vbarda commented on GitHub (Mar 27, 2025): This is fixed in langgraph==0.3.21
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#537