langchain-ai/langgraph · error · RuntimeError
{type(self).__name__}.schedule() requires a running event lo
Error message
{type(self).__name__}.schedule() requires a running event loop; this transformer must run under astream(), not stream(). Set requires_async=True on the class so this fails at registration rather than at first event. What it means
Error "{type(self).__name__}.schedule() requires a running event loop; this transformer must run under astream(), not stream(). Set requires_async=True on the class so this fails at registration rather than at first event." thrown in langchain-ai/langgraph.
Source
Thrown at libs/langgraph/langgraph/stream/_types.py:271
on_error: `"log"` (default) catches and logs any exception
the coroutine raises, so a single failure doesn't tear
down the run. `"raise"` lets the exception propagate
when the mux joins pendings, converting the close path
into the fail path.
Returns:
The asyncio Task. Authors rarely need to await it directly
— consumers read results from whatever projection the
coroutine pushes into.
Raises:
RuntimeError: If called without a running event loop (i.e.
under sync `stream()` rather than `astream()`).
"""
try:
asyncio.get_running_loop()
except RuntimeError:
raise RuntimeError(
f"{type(self).__name__}.schedule() requires a running "
"event loop; this transformer must run under astream(), "
"not stream(). Set requires_async=True on the class so "
"this fails at registration rather than at first event."
) from None
wrapped = self._wrap_scheduled(coro) if on_error == "log" else coro
task = asyncio.create_task(wrapped)
tasks = self._scheduled_task_set()
tasks.add(task)
task.add_done_callback(tasks.discard)
return task
@staticmethod
async def _wrap_scheduled(coro: Coroutine[Any, Any, Any]) -> Any:
try:
return await coro
except asyncio.CancelledError:View on GitHub (pinned to 38031739e5)
When it happens
Trigger: Thrown at libs/langgraph/langgraph/stream/_types.py:271 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26).
Data as JSON: /api/errors/c96ea135e14e2cfa.
Report an issue: GitHub.