# NodeError

> **Class** in `@langchain/langgraph`

📖 [View in docs](https://reference.langchain.com/javascript/langchain-langgraph/index/NodeError)

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).

## Signature

```javascript
class NodeError
```

## Constructors

- [`constructor()`](https://reference.langchain.com/javascript/langchain-langgraph/index/NodeError/constructor)

## Properties

- `error`
- `node`
- `unminifiable_name`

## Examples

```ts
import { NodeError } from "@langchain/langgraph";

function handler(state: State, error: NodeError) {
  return new Command({
    update: { status: `recovered from ${error.node}: ${error.error.message}` },
    goto: "finalize",
  });
}
```

---

[View source on GitHub](https://github.com/langchain-ai/langgraphjs/blob/b689df0c41d70d758ba72477a96de6afd23789cd/libs/langgraph-core/src/errors.ts#L134)