# handle-callback-err

Rule `node/handle-callback-err`. Require error handling in callbacks

- Source: node
- Technologies: Node.js
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 6.4M weekly downloads of presets that enable it
- Trend: +45.3% last quarter
- Rank: #1159 by reach, #900 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `n/handle-callback-err` | no | no | package `eslint-plugin-n` | [docs](https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/handle-callback-err.md) |
| Oxlint | `node/handle-callback-err` | no | no | plugin `node`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/node/handle-callback-err.html) |

## Code examples

### Incorrect: the rule reports this

```js
function loadData (err, data) {
    doSomething();
}
```

### Correct: the rule accepts this

```js
function loadData (err, data) {
    if (err) {
        console.log(err.stack);
    }
    doSomething();
}

function generateError (err) {
    if (err) {}
}
```

```js
function loadData (error, data) {
    if (error) {
       console.log(error.stack);
    }
    doSomething();
}
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import n from "eslint-plugin-n";

export default [
  {
    plugins: { n },
    rules: {
      "n/handle-callback-err": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "node"
  ],
  "rules": {
    "node/handle-callback-err": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [neostandard](https://lintradar.dev/presets/neostandard.md) | ESLint | `neostandard` | 95 | 317.6K | +50.2% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [eslint/handle-callback-err](https://lintradar.dev/rules/eslint/handle-callback-err.md): Require error handling in callbacks
- [node/no-new-require](https://lintradar.dev/rules/node/no-new-require.md): Disallow `new` operators with calls to `require`
- [node/no-callback-literal](https://lintradar.dev/rules/node/no-callback-literal.md): Enforce Node.js-style error-first callback pattern is followed
- [node/no-unpublished-require](https://lintradar.dev/rules/node/no-unpublished-require.md): Disallow `require()` expressions which import private modules
- [node/no-unpublished-import](https://lintradar.dev/rules/node/no-unpublished-import.md): Disallow `import` declarations which import private modules
- [node/no-missing-require](https://lintradar.dev/rules/node/no-missing-require.md): Disallow `require()` expressions which import missing modules

---

Web page: https://lintradar.dev/rules/node/handle-callback-err. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
