---
title: "X18N4005: No resource for the key"
description: "No resource for the key. Add a resource pattern for the locale, or create the locale file."
canonical_url: "https://x18n.dev/errors/x18n4005"
---
# X18N4005: No resource for the key

> No resource for the key. Add a resource pattern for the locale, or create the locale file.

<!-- Generated by docs/scripts/generate.ts from the source code. Do not edit. -->

## Message

```
[X18N4005] No resource for the key <detail>
├▶ fix: Add a resource pattern for the locale, or create the locale file.
╰▶ see: https://x18n.dev/errors/x18n4005
```

The CLI prints the code and why the error happened, with details such as a file name or a field. The fix and a link to this page follow. With `--json`, the same parts are in `errors` of the [envelope](https://x18n.dev/references/json-contracts).

## What to do

x18n has no resource where it can write the key in this locale.

1. Add a resource pattern in `resources` that covers the locale, for example `{ pattern: 'locales/{locale}.json' }`.
2. Or create the locale file, then run the command again.

## Exit code

The CLI exits with code `1`.

## Source

- [`packages/core/src/project/planner.ts`](https://github.com/x18n-dev/x18n/blob/main/packages/core/src/project/planner.ts)


## Sitemap

See the full [sitemap](https://x18n.dev/sitemap.md) for all pages.
