---
title: "X18N2005: Locale file could not be executed"
description: "Locale file could not be executed. Fix the error the file throws, or make it static and drop `execute: true`."
canonical_url: "https://x18n.dev/errors/x18n2005"
---
# X18N2005: Locale file could not be executed

> Locale file could not be executed. Fix the error the file throws, or make it static and drop \`execute: true\`.

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

## Message

```
[X18N2005] Locale file could not be executed <detail>
├▶ fix: Fix the error the file throws, or make it static and drop `execute: true`.
╰▶ see: https://x18n.dev/errors/x18n2005
```

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

The resource pattern has `execute: true`, so x18n ran the file in Node, and the file threw. A file run this way gets no framework globals: auto-imported helpers such as `defineI18nLocale` are not defined unless the file imports them.

1. Fix the error that the message names, or import what the file uses.
2. Or make the file a static `export default { ... }` and drop `execute: true`.

## Exit code

The CLI exits with code `1`.

## Source

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


## Sitemap

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