# catch-error-name

Rule `unicorn/catch-error-name`. Enforce a specific parameter name in catch clauses.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 12M weekly downloads of presets that enable it
- Trend: +40.1% last quarter
- Rank: #818 by reach, #1014 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/catch-error-name` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/catch-error-name.md) |
| Oxlint | `unicorn/catch-error-name` | no | safe | plugin `unicorn`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/unicorn/catch-error-name.html) |
| Biome | `nursery/useCatchErrorName` | no | unsafe | group nursery, since 2.6.7 | [docs](https://biomejs.dev/linter/rules/use-catch-error-name/) |

## Code examples

### Incorrect: the rule reports this

```js
try {} catch (badName) {}
```

```js
promise.catch(badName => {});
```

```js
promise.then(undefined, badName => {});
```

### Correct: the rule accepts this

```js
try {} catch (error) {}
```

```js
promise.catch(error => {});
```

```js
promise.then(undefined, error => {});
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/catch-error-name": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "unicorn/catch-error-name": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "useCatchErrorName": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/text-encoding-identifier-case](https://lintradar.dev/rules/unicorn/text-encoding-identifier-case.md): Enforce consistent case for text encoding identifiers.
- [unicorn/no-array-reduce](https://lintradar.dev/rules/unicorn/no-array-reduce.md): Disallow `Array#reduce()` and `Array#reduceRight()`.
- [unicorn/require-module-specifiers](https://lintradar.dev/rules/unicorn/require-module-specifiers.md): Require non-empty specifier list in import and export statements.
- [unicorn/no-immediate-mutation](https://lintradar.dev/rules/unicorn/no-immediate-mutation.md): Disallow immediate mutation after assignment and initialization immediately after declaration.
- [unicorn/require-module-attributes](https://lintradar.dev/rules/unicorn/require-module-attributes.md): Require non-empty module attributes for imports and exports
- [unicorn/consistent-assert](https://lintradar.dev/rules/unicorn/consistent-assert.md): Enforce consistent assertion style with `node:assert`.

---

Web page: https://lintradar.dev/rules/unicorn/catch-error-name. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
