Skip to content

Errors

While you may not want to see them, informative errors help you design better workflows. Below are the LangGraph-specific errors and what they mean.

GraphRecursionError

Bases: RecursionError

Raised when the graph has exhausted the maximum number of steps.

This prevents infinite loops. To increase the maximum number of steps, run your graph with a config specifying a higher recursion_limit.

Examples:

graph = builder.compile()
graph.invoke(
    {"messages": [("user", "Hello, world!")]},
    # The config is the second positional argument
    {"recursion_limit": 1000},
)
Source code in libs/langgraph/langgraph/errors.py
class GraphRecursionError(RecursionError):
    """Raised when the graph has exhausted the maximum number of steps.

    This prevents infinite loops. To increase the maximum number of steps,
    run your graph with a config specifying a higher `recursion_limit`.

    Examples:

        graph = builder.compile()
        graph.invoke(
            {"messages": [("user", "Hello, world!")]},
            # The config is the second positional argument
            {"recursion_limit": 1000},
        )
    """

    pass

EmptyChannelError

Bases: Exception

Raised when attempting to get the value of a channel that hasn't been updated for the first time yet.

Source code in libs/langgraph/langgraph/errors.py
class EmptyChannelError(Exception):
    """Raised when attempting to get the value of a channel that hasn't been updated
    for the first time yet."""

    pass

InvalidUpdateError

Bases: Exception

Raised when attempting to update a channel with an invalid sequence of updates.

Source code in libs/langgraph/langgraph/errors.py
class InvalidUpdateError(Exception):
    """Raised when attempting to update a channel with an invalid sequence of updates."""

    pass

Comments