Troubleshoot the CLI

Read a cruxy error and its code, then fix the sign-in, config, network, approval, and setup failures you are most likely to hit.

Every failure the CLI reports has the same shape, and every one carries a stable code you can search for. Start with the code, then find its section below. For every code and its exit status, see CLI command reference.

Read an error

An error prints a title, the cause when the CLI knows it, the next steps, and the code in brackets:

no API key for provider "cruxy"
Cause: no key in the environment (CRUXY_API_KEY) or the credentials store
 
Next steps:
  → run `cruxy login` to set a key interactively (saved to ~/.cruxy, owner-only)
  → or export CRUXY_API_KEY=… in your shell (env always wins; never written to config)
 
[CRUXY_E_AUTH_MISSING_KEY]

Errors go to stderr, and the process exits with the code's category status, so a script can branch on it. To see the underlying error and its stack, add --verbose, or set CRUXY_LOG_LEVEL=debug or DEBUG=1:

cruxy --verbose run "fix the failing test"

No API key

CRUXY_E_AUTH_MISSING_KEY, exit 4: "no API key for provider "cruxy"". Neither CRUXY_API_KEY nor the credential store holds a key.

  • In a terminal, run cruxy login.
  • In CI or a script, set CRUXY_API_KEY.

A first run in a terminal starts sign-in on its own. A run without a terminal, or after setup was already completed once, reports this error instead.

Credentials rejected

CRUXY_E_AUTH_INVALID, exit 4: "the provider rejected your credentials". The gateway answered 401 or 403.

  • If CRUXY_API_KEY is set, check it first: it wins over the saved credential.
  • Otherwise run cruxy login to sign in again and replace the saved credential.

A pasted key that has expired, or a key that was revoked, also lands here: the gateway gives them the same answer as a wrong key.

API keys need a paid plan

CRUXY_E_PAID_PLAN_REQUIRED, exit 22: "API keys need a paid Cruxy plan. Upgrade at https://cruxy.ai/settings/billing, or run cruxy login to use your account's allowance." The key is genuine, but its account's plan has no API access. A run, cruxy limits, and cruxy login --paste report it, and cruxy login --paste does not save such a key.

  • Move to a paid plan, or
  • Run cruxy login. The credential it saves draws on your plan's own allowance, on every plan.

Login expired

CRUXY_E_AUTH_EXPIRED, exit 4: "your cruxy login has expired". The device-login credential reached the expiry recorded when it was issued, 90 days after issue. Run cruxy login for a new one.

In the 7 days before expiry, each run and each session start prints a notice that your sign-in expires soon. Signing in again before then avoids the failure. When a one-shot run fails this way with an expired device credential still saved, check CRUXY_API_KEY too: the check reads the saved credential's expiry even when the variable is the key in use.

Login succeeded but nothing changed

cruxy login saves the new credential, but CRUXY_API_KEY still wins over it. The login warns about this when the variable is set. Unset CRUXY_API_KEY to use the saved credential:

unset CRUXY_API_KEY

Sign-in does not finish

The CLI saysWhat to do
cruxy login is interactiveRun it in a terminal, or set CRUXY_API_KEY. It exits 1.
the sign-in was declined in the browser.Run cruxy login again and approve.
the code expired before it was approved.Run cruxy login for a new code, and approve before it expires.
that sign-in could not be completed.Run cruxy login to start over.
couldn't reach the gateway to sign in.Check your connection and cruxy config get cruxy.gatewayUrl, then try again.

If you cannot approve in a browser on any machine, use cruxy login --paste with an existing key. See Sign in from the CLI.

The credential cannot be secured

CRUXY_E_CREDENTIALS_UNPROTECTED, exit 4: the CLI refuses to write a credential it cannot make readable only by you, or to read one from a store other users can read when it cannot make that store owner-only. This happens on filesystems without owner-only permissions, such as FAT or exFAT.

  • Set CRUXY_API_KEY instead. The environment is never written to disk.
  • Or keep your home directory on a filesystem that supports owner-only permissions, such as NTFS.

When the CLI finds a store other users can read and can fix it, it makes the store owner-only and warns once that anything in it may already have been copied. Rotate what it held: run cruxy login for a new key, revoke the old one in the Console, and issue any MCP tokens stored there again.

Cannot reach the gateway

CRUXY_E_GATEWAY_UNREACHABLE, exit 5: "could not reach the model gateway".

  1. Check your connection.
  2. Check the URL with cruxy config get cruxy.gatewayUrl. The default is https://api.cruxy.ai.
  3. Retry. The CLI already retried transient failures cruxy.maxRetries times.

A stream that delivers nothing for cruxy.streamIdleTimeoutMs (90 seconds by default) counts as dead. It is retried only if it died before its first token. If you see a warning that cruxy.gatewayUrl is the legacy gateway host, set it to https://api.cruxy.ai or remove it; the CLI already uses the current host.

The gateway URL is not https

CRUXY_E_CONFIG_INVALID, exit 3: "cruxy.gatewayUrl is not https, so no credential was sent". The CLI sends a credential only over https://, and over plain http:// only to localhost, 127.0.0.1, or [::1]. No request was made. Set an https:// URL, or remove the setting to use the default:

cruxy config set cruxy.gatewayUrl https://api.cruxy.ai

cruxy config path lists the config files in effect. See Gateway URL.

Rate limited, out of budget, or overloaded

CodeTitleWhat to do
CRUXY_E_API_RATE_LIMITrate limited by the model providerWait the time it names, or a moment when it names none, then retry.
CRUXY_E_BUDGET_EXHAUSTEDyour Cruxy budget is exhausted, or a variant naming the window or cap, such as your 12h burst budget window has nothing left, or this API key's monthly spend cap is reachedYour plan's pool, a key's spend cap, or a workspace's spend cap ran out. Wait for the reset or recovery it names; cruxy limits shows what is left. If it suggests /model epos, epos is still available. A larger plan raises the pool; only an org admin raises a key or workspace spend cap. /budget does not help.
CRUXY_E_SESSION_BUDGET_EXHAUSTEDthis session's budget is used upOnly the session's own /budget ran out. Raise it with /budget <weighted tokens>, or clear it with /budget off; /usage shows what the session has drawn.
CRUXY_E_API_OVERLOADEDthe model provider is overloadedRetry in a few moments.
CRUXY_E_APIthe model provider returned an errorRetry in a moment.

All but CRUXY_E_SESSION_BUDGET_EXHAUSTED exit 6; that one exits 2. cruxy limits shows what is left of your plan's pool. For the gateway's side of these limits, see Rate limits and budgets.

Request rejected

CRUXY_E_API_REQUEST_REJECTED, exit 6: the gateway refused the request as invalid, before any model ran. The same request fails the same way every time, so retrying does not help: it points to a defect in the CLI. Report it to [email protected] with the code and the cause line, or with the code and the tool name when the title names a tool.

Sign out does not finish

cruxy logout keeps your credential, and you stay signed in, whenever the key was not revoked:

CodeTitleWhat to do
CRUXY_E_AUTH_INVALID, exit 4this key is not allowed to revoke itself, so you are still signed inA read-only or scoped key cannot revoke itself. Revoke it in the Console at https://platform.cruxy.ai/keys, then run cruxy logout again to remove it.
CRUXY_E_GATEWAY_UNREACHABLE, exit 5could not reach the gateway to revoke your key, so you are still signed inRun cruxy logout again once the gateway is reachable, or revoke the key in the Console and then run it again.
CRUXY_E_API, exit 6the gateway did not revoke your key (HTTP <status>), so you are still signed inRetry in a moment, or revoke the key in the Console and then run it again.

See Sign out.

Config errors

CodeCauseWhat to do
CRUXY_E_CONFIG_PARSEA config file is not valid JSON.Fix the syntax, or delete the file to fall back to defaults.
CRUXY_E_CONFIG_INVALIDA key is unknown or a value is out of range. The cause lists each field.Correct the fields, starting with the file it names. cruxy config path shows the files in effect.
CRUXY_E_CONFIG_NOT_FOUND--config names a file that does not exist.Check the path, which is relative to the current directory.
CRUXY_E_CONFIG_KEY_UNKNOWNcruxy config get was given a key that does not exist.Run cruxy config list for the keys.

The config errors exit 3, and CRUXY_E_CONFIG_KEY_UNKNOWN exits 2. One common cause of CRUXY_E_CONFIG_INVALID is approval.mode, which accepts only prompt; see CLI configuration.

It needs a terminal

Message or codeWhat to do
cruxy run needs a prompt when stdin is not a terminal (CRUXY_E_USAGE, exit 2)Pass the task: cruxy run "<task>".
CRUXY_E_APPROVAL_REQUIRED, exit 10: this action needs your approval, but cruxy is running non-interactivelyRun in a terminal to approve it, or give the run a task its read-only tools can finish.
CRUXY_E_ROLLBACK_APPROVAL_REQUIRED, exit 10Run cruxy rollback in a terminal.
CRUXY_E_INTERACTIVE_REQUIRED, exit 2Run the command in a terminal.

The CLI never approves an action on its own when it cannot ask.

The run stopped before finishing

CRUXY_E_AGENT_INCOMPLETE, exit 20: a one-shot run stopped before the task was done. The work so far stays in the output above the error.

TitleWhat to do
cruxy stopped: iteration cap reached before the task finishedNarrow the task, or raise agent.maxIterationsOneShot.
cruxy stopped: token budget reached before the task finishedNarrow the task, or raise or unset agent.maxTokensPerTurn.
cruxy stopped: the run was cancelled before the task finishedRun it again.

A path is outside the project

CRUXY_E_PATH_ESCAPE, exit 7: a file tool was given a path that resolves outside the project root, directly or through a symlink. Start cruxy in a directory that contains everything the task touches, or declare more roots with --root; see Projects, permissions, and context.

Semantic search is not installed

CRUXY_E_INDEX_EMBEDDER_NOT_INSTALLED, exit 8: "semantic code search isn't installed", or a message that the runtime is out of date or was installed for another platform.

cruxy index --install

It shows the download size and source before it starts. Until it is installed, the agent finds code with grep_files. If the model download fails (CRUXY_E_INDEX_EMBEDDER_DOWNLOAD_FAILED) behind a proxy or firewall, allow huggingface.co and its download CDN; HTTPS_PROXY and NO_PROXY are honored.

Hooks, MCP servers, or memory are not trusted

CodeTitleWhat to do
CRUXY_E_HOOK_UNTRUSTEDthis project defines <n> hooks that are not trustedReview them with cruxy hooks list, then run cruxy hooks trust <path>.
CRUXY_E_MCP_UNTRUSTEDthis project's MCP servers have not been trustedReview them with cruxy mcp list, then run cruxy mcp trust ., or set mcp.enabled to false.

Untrusted project memory is not an error: the CLI skips it and prints that project memory was found but not trusted. Review it with cruxy memory list, then run cruxy memory trust . to recall it. A changed config or changed project memory must be trusted again.

Other setup errors

CodeTitleWhat to do
CRUXY_E_TEST_COMMAND_NOT_FOUNDno test command found for this projectSet test.command, or add a test script to package.json.
CRUXY_E_SANDBOX_UNAVAILABLEsandbox is enabled but the docker runtime is unavailableInstall Docker and start its daemon, or drop --sandbox and set sandbox.enabled to false.
CRUXY_E_NO_SHELLNo usable shell found to run commandsOn Windows, install Git for Windows for Git Bash, or set shell.executable.
CRUXY_E_FORGE_AUTHno github.com token available to open a pull requestSet GITHUB_TOKEN to a token with repo scope, or run gh auth login.
CRUXY_E_STORE_LOCKEDanother cruxy is writing <file>Retry in a moment. If no other cruxy is running, remove the lock file it names.

Unexpected internal error

CRUXY_E_INTERNAL, exit 1: "an unexpected internal error occurred". Run the command again with --verbose to see the underlying error, and report it with the code and that output to [email protected]. Never include your API key or the contents of ~/.cruxy/credentials.json in a report.

Was this page helpful?