langgraph studio error when trying to display a graph with a self looping node with agent #624

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

Originally created by @Courvoisier13 on GitHub (May 14, 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

import random
from typing import Literal

from langchain_core.messages import AIMessage
from langchain_core.tools import tool
from langchain_openai import ChatOpenAI
from langgraph.graph import END, START, MessagesState, StateGraph
from langgraph.prebuilt import create_react_agent
from langgraph.types import Command


@tool
def minimal_tool() -> str:
    """A minimal tool that does nothing but return a string."""
    return "Minimal tool executed."

llm = ChatOpenAI(model_name="gpt-4.1-nano", temperature=0)

MINIMAL_AGENT_PROMPT = "You are an agent. Use tools if necessary. Respond to the user."

minimal_agent = create_react_agent(
    model=llm,
    tools=[minimal_tool],
    prompt=MINIMAL_AGENT_PROMPT,
)

async def worker_node(state: MessagesState) -> Command[Literal["worker_node", END]]:
    agent_input = {"messages": state["messages"]}
    agent_result = await minimal_agent.ainvoke(agent_input)
    new_messages = state["messages"] + agent_result.get("messages", [])
    # llm_response_message = await llm.ainvoke(state["messages"])
    # new_messages = state["messages"] + [llm_response_message]

    if random.choice([True, False]):
        next_node_name = "worker_node"
        message_content = "Worker: Looping back to self."
    else:
        next_node_name = END
        message_content = "Worker: Transitioning to END."

    new_messages = new_messages + [AIMessage(content=message_content, name="worker_node_flow")]

    return Command(
        update={"messages": new_messages},
        goto=next_node_name,
    )

self_loop_builder = StateGraph(MessagesState)
self_loop_builder.add_node("worker_node", worker_node)
self_loop_builder.add_edge(START, "worker_node")
self_loop_graph = self_loop_builder.compile()

Error Message and Stack Trace (if applicable)

2025-05-14T08:26:31.340682Z [error    ] Exception in ASGI application
 [uvicorn.error] api_variant=local_dev thread_name=MainThread
  + Exception Group Traceback (most recent call last):
  |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_utils.py", line 76, in collapse_excgroups
  |     yield
  |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 177, in __call__
  |     async with anyio.create_task_group() as task_group:
  |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\anyio\_backends\_asyncio.py", line 772, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 403, in run_asgi
    |     result = await app(  # type: ignore[func-returns-value]
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in __call__
    |     return await self.app(scope, receive, send)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\applications.py", line 112, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\errors.py", line 187, in __call__
    |     raise exc
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\errors.py", line 165, in __call__
    |     await self.app(scope, receive, _send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 176, in __call__
    |     with recv_stream, send_stream, collapse_excgroups():
    |   File "C:\Program Files\Python311\Lib\contextlib.py", line 158, in __exit__
    |     self.gen.throw(typ, value, traceback)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_utils.py", line 82, in collapse_excgroups
    |     raise exc
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 178, in __call__
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\middleware\private_network.py", line 50, in dispatch
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 156, in call_next
    |     raise app_exc
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 141, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\cors.py", line 93, in __call__
    |     await self.simple_response(scope, receive, send, request_headers=headers)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\cors.py", line 144, in simple_response
    |     await self.app(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\middleware\http_logger.py", line 65, in __call__
    |     raise exc
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\middleware\http_logger.py", line 59, in __call__
    |     await self.app(scope, inner_receive, inner_send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\middleware\request_id.py", line 30, in __call__
    |     await self.app(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__
    |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app
    |     raise exc
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 714, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 734, in app
    |     await route.handle(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 460, in handle
    |     await self.app(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\auth\middleware.py", line 49, in __call__
    |     return await super().__call__(scope, receive, send)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\authentication.py", line 48, in __call__
    |     await self.app(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 714, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 734, in app
    |     await route.handle(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\route.py", line 134, in handle
    |     return await super().handle(scope, receive, send)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 288, in handle
    |     await self.app(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\route.py", line 49, in app
    |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app
    |     raise exc
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\route.py", line 42, in app
    |     response: ASGIApp = await func(request)
    |                         ^^^^^^^^^^^^^^^^^^^
    |   File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_runtime_inmem\retry.py", line 27, in wrap

Description

langgraph studio cannot display a graph with a node that has a self loop and that calls an agent.

  • remove the agent and call the llm -> no error
  • remove the self loop from the signature (replace -> Command[Literal["worker_node", END]] with -> Command[Literal[END]] and keep the agent -> no error

Note: this error shows up after updating to latest versions of langgraph langchain etc...
in older versions i was getting a different error, related to self_loop_graph.get_graph(xray=True).to_json(). when get_graph was used with (xray=True) to_json was throwing a KeyError 'worker_node

System Info

System Information

OS: Windows
OS Version: 10.0.19045
Python Version: 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]

Package Information

langchain_core: 0.3.59
langchain: 0.3.25
langchain_community: 0.3.24
langsmith: 0.3.30
langchain_anthropic: 0.3.10
langchain_experimental: 0.3.4
langchain_openai: 0.3.16
langchain_text_splitters: 0.3.8
langchainhub: 0.1.21
langgraph_api: 0.2.27
langgraph_cli: 0.2.10
langgraph_license: Installed. No version info available.
langgraph_runtime: Installed. No version info available.
langgraph_runtime_inmem: 0.0.11
langgraph_sdk: 0.1.69
langserve: 0.3.1

Other Dependencies

aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
anthropic<1,>=0.49.0: Installed. No version info available.
async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
blockbuster: 1.5.24
click: 8.1.8
cloudpickle: 3.1.1
cryptography: 44.0.2
dataclasses-json<0.7,>=0.5.7: Installed. No version info available.
fastapi: 0.115.12
httpx: 0.28.1
httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
jsonpatch<2.0,>=1.33: Installed. No version info available.
jsonschema-rs: 0.29.1
langchain-anthropic;: Installed. No version info available.
langchain-aws;: Installed. No version info available.
langchain-azure-ai;: Installed. No version info available.
langchain-cohere;: Installed. No version info available.
langchain-community;: Installed. No version info available.
langchain-core<1.0.0,>=0.3.45: Installed. No version info available.
langchain-core<1.0.0,>=0.3.51: Installed. No version info available.
langchain-core<1.0.0,>=0.3.58: Installed. No version info available.
langchain-core<1.0.0,>=0.3.59: Installed. No version info available.
langchain-deepseek;: Installed. No version info available.
langchain-fireworks;: Installed. No version info available.
langchain-google-genai;: Installed. No version info available.
langchain-google-vertexai;: Installed. No version info available.
langchain-groq;: Installed. No version info available.
langchain-huggingface;: Installed. No version info available.
langchain-mistralai;: Installed. No version info available.
langchain-ollama;: Installed. No version info available.
langchain-openai;: Installed. No version info available.
langchain-perplexity;: Installed. No version info available.
langchain-text-splitters<1.0.0,>=0.3.8: Installed. No version info available.
langchain-together;: Installed. No version info available.
langchain-xai;: Installed. No version info available.
langchain<1.0.0,>=0.3.25: Installed. No version info available.
langgraph: 0.4.3
langgraph-checkpoint: 2.0.25
langsmith-pyo3: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
langsmith<0.4,>=0.1.17: Installed. No version info available.
numpy>=1.26.2;: Installed. No version info available.
numpy>=2.1.0;: Installed. No version info available.
openai-agents: Installed. No version info available.
openai<2.0.0,>=1.68.2: 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.16
packaging: 24.2
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.11.3
pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.
pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
pydantic<3.0.0,>=2.7.4: Installed. No version info available.
pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
pyjwt: 2.10.1
pytest: 8.3.5
python-dotenv: 1.1.0
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.3
requests-toolbelt: 1.0.0
requests<3,>=2: Installed. No version info available.
rich: Installed. No version info available.
SQLAlchemy<3,>=1.4: Installed. No version info available.
sse-starlette: 2.1.3
starlette: 0.46.2
structlog: 25.2.0
tenacity: 9.1.2
tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken<1,>=0.7: Installed. No version info available.
truststore: 0.10.1
types-requests: 2.32.0.20250328
typing-extensions>=4.7: Installed. No version info available.
uvicorn: 0.34.1
watchfiles: 1.0.5
zstandard: 0.23.0

Originally created by @Courvoisier13 on GitHub (May 14, 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 import random from typing import Literal from langchain_core.messages import AIMessage from langchain_core.tools import tool from langchain_openai import ChatOpenAI from langgraph.graph import END, START, MessagesState, StateGraph from langgraph.prebuilt import create_react_agent from langgraph.types import Command @tool def minimal_tool() -> str: """A minimal tool that does nothing but return a string.""" return "Minimal tool executed." llm = ChatOpenAI(model_name="gpt-4.1-nano", temperature=0) MINIMAL_AGENT_PROMPT = "You are an agent. Use tools if necessary. Respond to the user." minimal_agent = create_react_agent( model=llm, tools=[minimal_tool], prompt=MINIMAL_AGENT_PROMPT, ) async def worker_node(state: MessagesState) -> Command[Literal["worker_node", END]]: agent_input = {"messages": state["messages"]} agent_result = await minimal_agent.ainvoke(agent_input) new_messages = state["messages"] + agent_result.get("messages", []) # llm_response_message = await llm.ainvoke(state["messages"]) # new_messages = state["messages"] + [llm_response_message] if random.choice([True, False]): next_node_name = "worker_node" message_content = "Worker: Looping back to self." else: next_node_name = END message_content = "Worker: Transitioning to END." new_messages = new_messages + [AIMessage(content=message_content, name="worker_node_flow")] return Command( update={"messages": new_messages}, goto=next_node_name, ) self_loop_builder = StateGraph(MessagesState) self_loop_builder.add_node("worker_node", worker_node) self_loop_builder.add_edge(START, "worker_node") self_loop_graph = self_loop_builder.compile() ``` ### Error Message and Stack Trace (if applicable) ```shell 2025-05-14T08:26:31.340682Z [error ] Exception in ASGI application [uvicorn.error] api_variant=local_dev thread_name=MainThread + Exception Group Traceback (most recent call last): | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_utils.py", line 76, in collapse_excgroups | yield | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 177, in __call__ | async with anyio.create_task_group() as task_group: | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\anyio\_backends\_asyncio.py", line 772, in __aexit__ | raise BaseExceptionGroup( | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 403, in run_asgi | result = await app( # type: ignore[func-returns-value] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in __call__ | return await self.app(scope, receive, send) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\applications.py", line 112, in __call__ | await self.middleware_stack(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\errors.py", line 187, in __call__ | raise exc | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\errors.py", line 165, in __call__ | await self.app(scope, receive, _send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 176, in __call__ | with recv_stream, send_stream, collapse_excgroups(): | File "C:\Program Files\Python311\Lib\contextlib.py", line 158, in __exit__ | self.gen.throw(typ, value, traceback) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_utils.py", line 82, in collapse_excgroups | raise exc | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 178, in __call__ | response = await self.dispatch_func(request, call_next) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\middleware\private_network.py", line 50, in dispatch | response = await call_next(request) | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 156, in call_next | raise app_exc | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\base.py", line 141, in coro | await self.app(scope, receive_or_disconnect, send_no_error) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\cors.py", line 93, in __call__ | await self.simple_response(scope, receive, send, request_headers=headers) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\cors.py", line 144, in simple_response | await self.app(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\middleware\http_logger.py", line 65, in __call__ | raise exc | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\middleware\http_logger.py", line 59, in __call__ | await self.app(scope, inner_receive, inner_send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\middleware\request_id.py", line 30, in __call__ | await self.app(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__ | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app | raise exc | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app | await app(scope, receive, sender) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 714, in __call__ | await self.middleware_stack(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 734, in app | await route.handle(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 460, in handle | await self.app(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\auth\middleware.py", line 49, in __call__ | return await super().__call__(scope, receive, send) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\middleware\authentication.py", line 48, in __call__ | await self.app(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 714, in __call__ | await self.middleware_stack(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 734, in app | await route.handle(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\route.py", line 134, in handle | return await super().handle(scope, receive, send) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\routing.py", line 288, in handle | await self.app(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\route.py", line 49, in app | await wrap_app_handling_exceptions(app, request)(scope, receive, send) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app | raise exc | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app | await app(scope, receive, sender) | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_api\route.py", line 42, in app | response: ASGIApp = await func(request) | ^^^^^^^^^^^^^^^^^^^ | File "C:\Users\k\AppData\Local\pypoetry\Cache\virtualenvs\agent-SA8rPvB8-py3.11\Lib\site-packages\langgraph_runtime_inmem\retry.py", line 27, in wrap ``` ### Description langgraph studio cannot display a graph with a node that has a self loop and that calls an agent. - remove the agent and call the llm -> no error - remove the self loop from the signature (replace `-> Command[Literal["worker_node", END]]` with `-> Command[Literal[END]]` and keep the agent -> no error Note: this error shows up after updating to latest versions of `langgraph` `langchain` etc... in older versions i was getting a different error, related to `self_loop_graph.get_graph(xray=True).to_json()`. when `get_graph` was used with `(xray=True)` `to_json` was throwing a `KeyError 'worker_node` ### System Info System Information ------------------ > OS: Windows > OS Version: 10.0.19045 > Python Version: 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] Package Information ------------------- > langchain_core: 0.3.59 > langchain: 0.3.25 > langchain_community: 0.3.24 > langsmith: 0.3.30 > langchain_anthropic: 0.3.10 > langchain_experimental: 0.3.4 > langchain_openai: 0.3.16 > langchain_text_splitters: 0.3.8 > langchainhub: 0.1.21 > langgraph_api: 0.2.27 > langgraph_cli: 0.2.10 > langgraph_license: Installed. No version info available. > langgraph_runtime: Installed. No version info available. > langgraph_runtime_inmem: 0.0.11 > langgraph_sdk: 0.1.69 > langserve: 0.3.1 Other Dependencies ------------------ > aiohttp<4.0.0,>=3.8.3: Installed. No version info available. > anthropic<1,>=0.49.0: Installed. No version info available. > async-timeout<5.0.0,>=4.0.0;: Installed. No version info available. > blockbuster: 1.5.24 > click: 8.1.8 > cloudpickle: 3.1.1 > cryptography: 44.0.2 > dataclasses-json<0.7,>=0.5.7: Installed. No version info available. > fastapi: 0.115.12 > httpx: 0.28.1 > httpx-sse<1.0.0,>=0.4.0: Installed. No version info available. > jsonpatch<2.0,>=1.33: Installed. No version info available. > jsonschema-rs: 0.29.1 > langchain-anthropic;: Installed. No version info available. > langchain-aws;: Installed. No version info available. > langchain-azure-ai;: Installed. No version info available. > langchain-cohere;: Installed. No version info available. > langchain-community;: Installed. No version info available. > langchain-core<1.0.0,>=0.3.45: Installed. No version info available. > langchain-core<1.0.0,>=0.3.51: Installed. No version info available. > langchain-core<1.0.0,>=0.3.58: Installed. No version info available. > langchain-core<1.0.0,>=0.3.59: Installed. No version info available. > langchain-deepseek;: Installed. No version info available. > langchain-fireworks;: Installed. No version info available. > langchain-google-genai;: Installed. No version info available. > langchain-google-vertexai;: Installed. No version info available. > langchain-groq;: Installed. No version info available. > langchain-huggingface;: Installed. No version info available. > langchain-mistralai;: Installed. No version info available. > langchain-ollama;: Installed. No version info available. > langchain-openai;: Installed. No version info available. > langchain-perplexity;: Installed. No version info available. > langchain-text-splitters<1.0.0,>=0.3.8: Installed. No version info available. > langchain-together;: Installed. No version info available. > langchain-xai;: Installed. No version info available. > langchain<1.0.0,>=0.3.25: Installed. No version info available. > langgraph: 0.4.3 > langgraph-checkpoint: 2.0.25 > langsmith-pyo3: Installed. No version info available. > langsmith<0.4,>=0.1.125: Installed. No version info available. > langsmith<0.4,>=0.1.17: Installed. No version info available. > numpy>=1.26.2;: Installed. No version info available. > numpy>=2.1.0;: Installed. No version info available. > openai-agents: Installed. No version info available. > openai<2.0.0,>=1.68.2: 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.16 > packaging: 24.2 > packaging<25,>=23.2: Installed. No version info available. > pydantic: 2.11.3 > pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available. > pydantic<3.0.0,>=2.5.2;: Installed. No version info available. > pydantic<3.0.0,>=2.7.4: Installed. No version info available. > pydantic<3.0.0,>=2.7.4;: Installed. No version info available. > pyjwt: 2.10.1 > pytest: 8.3.5 > python-dotenv: 1.1.0 > PyYAML>=5.3: Installed. No version info available. > requests: 2.32.3 > requests-toolbelt: 1.0.0 > requests<3,>=2: Installed. No version info available. > rich: Installed. No version info available. > SQLAlchemy<3,>=1.4: Installed. No version info available. > sse-starlette: 2.1.3 > starlette: 0.46.2 > structlog: 25.2.0 > tenacity: 9.1.2 > tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available. > tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available. > tiktoken<1,>=0.7: Installed. No version info available. > truststore: 0.10.1 > types-requests: 2.32.0.20250328 > typing-extensions>=4.7: Installed. No version info available. > uvicorn: 0.34.1 > watchfiles: 1.0.5 > zstandard: 0.23.0
yindo closed this issue 2026-02-20 17:41:00 -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#624