Skip to main content
This page documents all error types and exceptions used in LangGraph, along with guidance on how to handle them.

Error Codes

Enum
Enumeration of error codes for common LangGraph errors.Each error code corresponds to a specific type of failure and links to detailed troubleshooting documentation.Defined in: langgraph/errors.py:29

Values

ErrorCode
Graph has exhausted the maximum number of steps.Troubleshooting: GRAPH_RECURSION_LIMIT
ErrorCode
Multiple nodes attempted to update the same channel concurrently with incompatible values.Troubleshooting: INVALID_CONCURRENT_GRAPH_UPDATE
ErrorCode
A node returned an invalid value that cannot be processed by the graph.Troubleshooting: INVALID_GRAPH_NODE_RETURN_VALUE
ErrorCode
Multiple subgraphs are configured incorrectly.Troubleshooting: MULTIPLE_SUBGRAPHS
ErrorCode
Chat history is in an invalid format.Troubleshooting: INVALID_CHAT_HISTORY

Exception Types

GraphRecursionError

class
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.Inherits from: RecursionError
Defined in: langgraph/errors.py:45

When It Occurs

This error is raised when:
  • A graph executes more steps than allowed by recursion_limit (default is 25)
  • There’s an infinite loop in your graph logic
  • Your workflow is legitimately long but needs a higher limit

How to Fix

Best Practices

  1. Set appropriate limits: Choose a recursion limit based on your expected workflow length
  2. Add loop detection: Use state fields to track iteration counts
  3. Add exit conditions: Ensure conditional edges eventually lead to END

InvalidUpdateError

class
Raised when attempting to update a channel with an invalid set of updates.This typically occurs when:
  • Multiple nodes try to write incompatible values to the same channel
  • A node returns a value that doesn’t match the expected state schema
Inherits from: Exception
Defined in: langgraph/errors.py:68

Common Causes

  1. Concurrent conflicting updates: Multiple parallel nodes updating the same non-reducible channel
  2. Invalid return values: Node returns wrong type or structure
  3. Multiple Overwrite values: Multiple Overwrite objects for the same channel

Examples and Solutions

Concurrent Updates
Invalid Return Values

GraphInterrupt

class
Raised when a subgraph is interrupted, suppressed by the root graph.This exception is never raised directly to the user - it’s an internal exception used by LangGraph to handle interrupts. Users should use the interrupt() function instead.Inherits from: GraphBubbleUp
Defined in: langgraph/errors.py:84

Usage

This is an internal exception. For human-in-the-loop workflows, use interrupt():

NodeInterrupt (Deprecated)

class
Deprecated: Use interrupt() instead.Raised by a node to interrupt execution.Inherits from: GraphInterrupt
Defined in: langgraph/errors.py:96
Deprecated in: v1.0

Migration

ParentCommand

class
Internal exception used to bubble up commands to parent graphs.This is an internal exception used by LangGraph’s command system. Users don’t need to handle or raise this exception directly.Inherits from: GraphBubbleUp
Defined in: langgraph/errors.py:111

EmptyInputError

class
Raised when graph receives an empty input.Inherits from: Exception
Defined in: langgraph/errors.py:118

When It Occurs

How to Handle

TaskNotFound

class
Raised when the executor is unable to find a task (for distributed mode).This error occurs in distributed execution mode when a task cannot be located or has been lost.Inherits from: Exception
Defined in: langgraph/errors.py:124

EmptyChannelError

class
Raised when attempting to read from a channel that has no value.This error is re-exported from langgraph.checkpoint.base.Defined in: langgraph/errors.py:9

When It Occurs

Error Handling Patterns

Pattern 1: Graceful Degradation

Pattern 2: Retry with Adjusted Config

Pattern 3: State Validation

Pattern 4: Logging and Monitoring

Utilities

create_error_message

function
Create a formatted error message with a link to troubleshooting documentation.Parameters:
  • message (str): The error message
  • error_code (ErrorCode): The error code enum value
Returns: str - Formatted error message with documentation linkDefined in: langgraph/errors.py:37

Usage

Best Practices

1. Set Appropriate Recursion Limits

2. Use Reducers for Concurrent Updates

3. Validate Node Outputs

4. Handle Interrupts Properly