Skip to main content
When a command fails, the CLI tells you three things: what went wrong, the command that fixes it, and an exit code that says what kind of failure it was. A script can branch on the exit code, and a coding agent can read the fix from the JSON output.

A failing command

Run a command without signing in:
The error goes to stderr. mutagent login and mutagent auth login are the same command. The same command with --json:

The JSON error object

With --json, a failed command prints one JSON object on stdout. Every one has these fields: Sign-in, workspace and access errors also carry remediation: the commands that fix each case. Another example, a workspace name that does not exist:

Exit codes

Every command uses the same four exit codes. Under --json, success is true exactly when the exit code is 0. mutagent on its own, or a command group on its own such as mutagent env, prints its help and exits 0. Commands that run something in a cloud sandbox pass its exit status through instead: mutagent helix runs, helix doctor and helix smoke exit with Helix’s own exit status. See Run a task.

Delete commands need —force

A command that deletes something never asks “are you sure?”. It refuses unless you pass --force (or -f), and it deletes nothing:
The exit code is 1 and the error code is CONFIRMATION_REQUIRED. Run it again with --force once you are sure:
This way a script or a coding agent can never hang on a question it cannot answer, and a delete always happens on purpose. With --json, the error’s _agentGuidance.escalate tells a coding agent to confirm with you before it runs the command again with --force. The rule holds in every mode: in a terminal, with --json, and with --non-interactive. It covers every command that deletes, removes or stops something, including env delete, env unset, env set --replace, providers delete, sandbox delete, helix session signal, agent retire, reports retract, integrations sources remove, and the gateway’s disconnect, repos unlink, triggers delete, routines delete and runs cancel. The gateway, reports and integrations commands also accept --yes in place of --force. List and delete commands have one name each, with a short alias: list also answers to ls, and delete to rm.

Common errors

You are not signed in on this machine and MUTAGENT_API_KEY is not set. Run mutagent login. In CI, set MUTAGENT_API_KEY to an API key. See API keys.
Your saved key expired or was revoked, or the key you passed is not a Mutagent key. Mutagent keys start with mg_live_. Run mutagent login again, or set a valid MUTAGENT_API_KEY.
The command works in a workspace and none is selected. Run mutagent workspaces list, then mutagent workspaces use <name>, or pass --workspace <name> for one command. With a MUTAGENT_API_KEY you did not save with mutagent login, set MUTAGENT_WORKSPACE_ID instead.
You ran mutagent workspaces use with MUTAGENT_API_KEY set to a key you did not save with mutagent login. Such a key has no saved workspace. Pass --workspace <name-or-id>, set MUTAGENT_WORKSPACE_ID, or run mutagent login --json once to save the key.
mutagent login --json had no way to sign in: no MUTAGENT_API_KEY, no --browser, and no terminal to ask in. Run mutagent login --browser --json and show the printed URL to a person, or set MUTAGENT_API_KEY and run mutagent login --json. See Sign in.
The workspace you named is not one of your workspaces in this organization. Check the name with mutagent workspaces list.
You passed --org and your key belongs to another organization. Nothing was sent. To work in that organization, sign in to it: mutagent login --org <slug>.
Cloud sandboxes are in early access and not enabled for your account yet. Nothing was started. See Helix Cloud.
For errors from cloud runs, such as a missing model, see Troubleshooting cloud runs.