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

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

GraphInterrupt

Bases: Exception

Raised when a subgraph is interrupted.

Source code in libs/langgraph/langgraph/errors.py
class GraphInterrupt(Exception):
    """Raised when a subgraph is interrupted."""

    def __init__(self, interrupts: Sequence[Interrupt] = ()) -> None:
        super().__init__(interrupts)

NodeInterrupt

Bases: GraphInterrupt

Raised by a node to interrupt execution.

Source code in libs/langgraph/langgraph/errors.py
class NodeInterrupt(GraphInterrupt):
    """Raised by a node to interrupt execution."""

    def __init__(self, value: Any) -> None:
        super().__init__([Interrupt(value)])

GraphDelegate

Bases: Exception

Raised when a graph is delegated.

Source code in libs/langgraph/langgraph/errors.py
class GraphDelegate(Exception):
    """Raised when a graph is delegated."""

    def __init__(self, *args: dict[str, Any]) -> None:
        super().__init__(*args)

EmptyInputError

Bases: Exception

Raised when graph receives an empty input.

Source code in libs/langgraph/langgraph/errors.py
class EmptyInputError(Exception):
    """Raised when graph receives an empty input."""

    pass

TaskNotFound

Bases: Exception

Raised when the executor is unable to find a task.

Source code in libs/langgraph/langgraph/errors.py
class TaskNotFound(Exception):
    """Raised when the executor is unable to find a task."""

    pass

CheckpointNotLatest

Bases: Exception

Raised when the checkpoint is not the latest version.

Source code in libs/langgraph/langgraph/errors.py
class CheckpointNotLatest(Exception):
    """Raised when the checkpoint is not the latest version."""

    pass

Comments