Skip to content

langgraph.errors.GraphRecursionError: Recursion limit of 25 reached without hitting a stop condition. #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
stelterlab opened this issue May 11, 2025 · 3 comments

Comments

@stelterlab
Copy link

I got this error while running a research. Found a limit set in src/workflow.py set to 100. Doesn't seem to get used.

Used version of yesterday (69d6e16) with OpenAI as LLM provider and Tavily AI as Search Engine.

My request was: "How to create a read only user in OpenStack who can see every resource in every project and every domain?"

`ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 270, in call
await wrap(partial(self.listen_for_disconnect, receive))
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 266, in wrap
await func()
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 234, in listen_for_disconnect
message = await receive()
^^^^^^^^^^^^^^^
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 531, in receive
await self.message_event.wait()
File "/Users/cosinus/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/asyncio/locks.py", line 212, in wait
await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 10a9cee40

During handling of the above exception, another exception occurred:

  • Exception Group Traceback (most recent call last):
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_utils.py", line 76, in collapse_excgroups
    | yield
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 263, in call
    | async with anyio.create_task_group() as task_group:
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 767, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in call
    | await super().call(scope, receive, send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/applications.py", line 112, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in call
    | raise exc
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in call
    | await self.app(scope, receive, _send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 93, in call
    | await self.simple_response(scope, receive, send, request_headers=headers)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 144, in simple_response
    | await self.app(scope, receive, send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in call
    | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    | raise exc
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    | await app(scope, receive, sender)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 714, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 734, in app
    | await route.handle(scope, receive, send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
    | await self.app(scope, receive, send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
    | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    | raise exc
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    | await app(scope, receive, sender)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 74, in app
    | await response(scope, receive, send)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 262, in call
    | with collapse_excgroups():
    | ^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/contextlib.py", line 158, in exit
    | self.gen.throw(value)
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
    | raise exc
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 266, in wrap
    | await func()
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 246, in stream_response
    | async for chunk in self.body_iterator:
    | File "/Users/cosinus/src/deer-flow/src/server/app.py", line 98, in _astream_workflow_generator
    | async for agent, _, event_data in graph.astream(
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/init.py", line 2305, in astream
    | async for _ in runner.atick(
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/runner.py", line 527, in atick
    | _panic_or_proceed(
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/runner.py", line 619, in _panic_or_proceed
    | raise exc
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/retry.py", line 128, in arun_with_retry
    | return await task.proc.ainvoke(task.input, config)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/utils/runnable.py", line 583, in ainvoke
    | input = await step.ainvoke(input, config, **kwargs)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/utils/runnable.py", line 371, in ainvoke
    | ret = await asyncio.create_task(coro, context=context)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/src/deer-flow/src/graph/nodes.py", line 420, in researcher_node
    | return await _setup_and_execute_agent_step(
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/src/deer-flow/src/graph/nodes.py", line 412, in _setup_and_execute_agent_step
    | return await _execute_agent_step(state, default_agent, agent_type)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/src/deer-flow/src/graph/nodes.py", line 331, in _execute_agent_step
    | result = await agent.ainvoke(input=agent_input)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/init.py", line 2420, in ainvoke
    | async for chunk in self.astream(
    | File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/init.py", line 2327, in astream
    | raise GraphRecursionError(msg)
    | langgraph.errors.GraphRecursionError: Recursion limit of 25 reached without hitting a stop condition. You can increase the limit by setting the recursion_limit config key.
    | For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/GRAPH_RECURSION_LIMIT
    | During task with name 'researcher' and id '52c1115d-7c8c-9b68-249f-25927e097f6b'
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 93, in call
await self.simple_response(scope, receive, send, request_headers=headers)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 144, in simple_response
await self.app(scope, receive, send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 714, in call
await self.middleware_stack(scope, receive, send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/routing.py", line 74, in app
await response(scope, receive, send)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 262, in call
with collapse_excgroups():
^^^^^^^^^^^^^^^^^^^^
File "/Users/cosinus/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
raise exc
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 266, in wrap
await func()
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/starlette/responses.py", line 246, in stream_response
async for chunk in self.body_iterator:
File "/Users/cosinus/src/deer-flow/src/server/app.py", line 98, in _astream_workflow_generator
async for agent, _, event_data in graph.astream(
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/init.py", line 2305, in astream
async for _ in runner.atick(
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/runner.py", line 527, in atick
_panic_or_proceed(
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/runner.py", line 619, in _panic_or_proceed
raise exc
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/retry.py", line 128, in arun_with_retry
return await task.proc.ainvoke(task.input, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/utils/runnable.py", line 583, in ainvoke
input = await step.ainvoke(input, config, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/utils/runnable.py", line 371, in ainvoke
ret = await asyncio.create_task(coro, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cosinus/src/deer-flow/src/graph/nodes.py", line 420, in researcher_node
return await _setup_and_execute_agent_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cosinus/src/deer-flow/src/graph/nodes.py", line 412, in _setup_and_execute_agent_step
return await _execute_agent_step(state, default_agent, agent_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cosinus/src/deer-flow/src/graph/nodes.py", line 331, in _execute_agent_step
result = await agent.ainvoke(input=agent_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/init.py", line 2420, in ainvoke
async for chunk in self.astream(
File "/Users/cosinus/src/deer-flow/.venv/lib/python3.12/site-packages/langgraph/pregel/init.py", line 2327, in astream
raise GraphRecursionError(msg)
langgraph.errors.GraphRecursionError: Recursion limit of 25 reached without hitting a stop condition. You can increase the limit by setting the recursion_limit config key.
For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/GRAPH_RECURSION_LIMIT
During task with name 'researcher' and id '52c1115d-7c8c-9b68-249f-25927e097f6b'`

@fxnie
Copy link

fxnie commented May 12, 2025

same

Image

@biosafetylvl5
Copy link

biosafetylvl5 commented May 13, 2025

Same 😢

Image
This also occurred for me (like @stelterlab) while handling another exception.

Using the latest commit as of now, with docker.

@changqingla
Copy link
Contributor

#138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants