Failure context passed to a node-level error handler.
A node-level error handler is registered via
StateGraph.addNode(name, fn, { errorHandler }). The handler runs ONLY after
the failing node's RetryPolicy is exhausted, so retry and handling
stay decoupled. The handler receives the failed node's name and the thrown
error via a NodeError instance, can return a state update, and can route to
a recovery branch via new Command({ goto }) (saga / compensation flows).
class NodeErrorimport { NodeError } from "@langchain/langgraph";
function handler(state: State, error: NodeError) {
return new Command({
update: { status: `recovered from ${error.node}: ${error.error.message}` },
goto: "finalize",
});
}Error thrown by the failed node.
Name of the node whose execution failed.