Shipping an AI app or agent? Security review in 1 working day: $149 / ₹13,900. Request a review →
AI Review Ready
Home / Error fixes / Error loading config.toml
Fix · Codex CLI

Codex CLI: Error loading config.toml

Codex reads ~/.codex/config.toml at startup and exits if it can't parse it. The message points at the exact line and column, and most cases are a TOML syntax slip, an old profile setting, or a file damaged by a crash.

Desktop app says elastic section minimums must sum to DEFAULT_MAX_INPUT_TOKENS (128000), got 126000 (or 130000)? That one is not a TOML mistake: see the fix.

Fix it

  1. Open the file the error names. User config is ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml). If you set CODEX_HOME, it is in that folder instead. A project can also have .codex/config.toml, loaded only for trusted projects.
  2. Go to the line and column in the message and fix the TOML there (common slips below).
  3. If the message mentions a legacy profile, move the profile into its own file (section below).
  4. Check the result: codex doctor diagnoses the installation, config, auth and runtime health.
  5. If the file is damaged beyond repair, back it up, rename it, and start Codex again; then re-add your settings one block at a time.

What the error looks like

Error loading config.toml:
C:\Users\you\.codex\config.toml:1:7: key with no value, expected '='

The numbers after the path are line and column. Recent versions also print the source line with a caret under the problem, and exit immediately (as reported in issue #52848 on v0.162.1).

Common TOML mistakes

  • A key with no value (badkey alone on a line): every key needs = value.
  • Unquoted text: approval_policy = on-request must be approval_policy = "on-request".
  • The same key or table twice: the TOML spec forbids defining a key more than once, which often happens after pasting a block from a README.
  • Windows paths in double quotes: backslashes start escapes in basic strings. Use single quotes ('C:\tools\server.exe') or double the backslashes.

A valid minimal file looks like this:

approval_policy = "on-request"
sandbox_mode = "workspace-write"
model_reasoning_effort = "medium"

"legacy profile config is no longer supported"

From Codex 0.134.0, --profile no longer reads [profiles.<name>] tables from config.toml. A leftover selector stops startup with:

legacy `profile = "work"` config is no longer supported; use `--profile work` with `work.config.toml` instead

To migrate (issue #24858 documents the same steps):

  1. Back up ~/.codex/config.toml.
  2. Move the settings from [profiles.work] to the top level of a new file, ~/.codex/work.config.toml.
  3. Delete the [profiles.work] table and the profile = "work" line from config.toml.
  4. Run codex --profile work (or codex exec --profile work "...").

Profile names can contain letters, numbers, hyphens and underscores.

The file got corrupted after a crash

Several reports (issue #54723 and others) describe config.toml becoming unreadable after a blue screen or power loss, with errors at a high column number on line 1. If the file is mostly empty bytes, there is nothing to repair: rename it, start Codex on its built-in defaults, and restore your settings from a backup.

Errors from -c / --config

Values passed with -c are parsed as TOML, so strings need TOML quotes inside shell quotes, and dots set nested keys:

codex --config model='"<model-name>"'
codex --config sandbox_workspace_write.network_access=true
codex --config 'shell_environment_policy.include_only=["PATH","HOME"]'

If a value can't be parsed as TOML, Codex treats it as a string.

Settings ignored without an error

  • Precedence, highest first: CLI flags and --config, project .codex/config.toml (trusted projects only), the --profile file, user config, cloud-managed defaults, system config (/etc/codex/config.toml on Unix), built-in defaults.
  • Some keys, such as model_provider, model_providers, notify and profile, are ignored in a project's .codex/config.toml, with a startup warning.
  • To catch misspelled keys, start with --strict-config: Codex then errors when config.toml contains fields this version doesn't recognize.

Running Claude Code, Codex or Cursor on real repos, or shipping an AI agent? A Quick Review ($149 / ₹13,900, 1 working day) checks one repo, config or setup for leaked keys, risky agent permissions and MCP servers. Request a Quick Review

FAQ

Where is the Codex config.toml file?

User config is ~/.codex/config.toml, or config.toml inside CODEX_HOME if you set it. Projects can add .codex/config.toml, which Codex loads only when you trust the project.

How do I use profiles in Codex 0.134.0 and later?

Put each profile in its own file, ~/.codex/<name>.config.toml, and select it with --profile <name>. [profiles.<name>] tables in config.toml are no longer read.

How do I find typos in my Codex config?

Run Codex with --strict-config, which errors on fields this version doesn't recognize, and run codex doctor to check the config loads.

Codex won't start after my PC crashed. What happened?

GitHub issue #54723 and later reports describe config.toml being corrupted by a crash or power loss. Rename the damaged file and restore your settings.

Related errors

Sources

Read 29 Nov 2026. These tools change often: if a step no longer matches, the linked page wins.

Related free tools