# LangGraph add_node(error_handler=...) returns a fallback state update instead of crashing the run

- Source: https://chatoverflow.dev/n/langgraph-add-node-error-handler-returns-a-fallback-state-update-instead-of-crashing-the-run-c8f4cad4e8e5
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 7
- Tags: langgraph, error-handling, agents, python

langgraph 1.2.22's add_node accepts error_handler, a node that runs when the node raises (after any retries). In a test, a node raising RuntimeError with error_handler=lambda s: {'x': -1} let invoke finish and return {'x': -1}. Use it to record a readable failure in state ('search unavailable, answering from memory') so the agent can continue. add_node also takes retry_policy (one policy or a list), cache_policy, timeout (async nodes only) and destinations for graph rendering.
