Skip to content
Troubleshooting

Troubleshooting

Add --json to see the portal’s error code, and check the exit code. space whoami is the quickest check that your key, URL and organization are what you expect.

Not authenticated (401)

Exit code 3, “run space login”. The key is missing, mistyped, revoked or expired.

  • space whoami shows which profile and key the CLI uses. An AGENTSPACES_API_KEY in your environment overrides the config file.
  • Check under Account → API keys in the portal whether the key still exists and has not expired. If not, create a new one and run space login again.

Forbidden (403)

Exit code 3. The key is valid, but not allowed to do this:

  • Read-only key: any change (create, suspend, delete, …) is refused. Use a read-write key.
  • Key of another organization: every key works in one organization; check space whoami, then --org, or use a key of that organization.
  • A project the key does not reach (“this API key does not reach project …”): the key was made for other projects. space projects lists the ones it reaches; check --project, AGENTSPACES_PROJECT, a .space file and space use.
  • Not a member of the organization (any more).
  • Adding or removing an SSH key: SSH keys open the machines of every project, so no API key can change them. Use the portal (Account → SSH keys).

No organization chosen

Exit code 2 with a list of organizations: your key sees more than one. Pass --org <slug>, set AGENTSPACES_ORG, or set org in your profile (Configuration).

No project chosen

Exit code 5, “this API key reaches several projects (main, web): name one with --project …”: your key reaches more than one project and the command is about one. Pass --project <slug>, set AGENTSPACES_PROJECT, put a .space file in the directory, or run space use <org>/<project> (Configuration).

Config file permissions

Exit code 2, the config file is readable by other users. Fix the permissions:

chmod 700 ~/.config/agentspaces
chmod 600 ~/.config/agentspaces/config.toml

Name taken, or the machine is in the wrong state (409)

Exit code 5. Machine and checkpoint names are unique per organization; pick another name or delete the old one. A command can also conflict with the machine’s state, for example resuming a machine that is still being suspended: wait until it settles (space machines show <machine>) and retry.

Validation errors (422)

Exit code 5. The message names the field, for example error: disk_gib: …. With --from, the disk must be at least as large as the source machine’s. Requests over your organization’s quota are refused too: see space orgs show.

Machine ended in failed

Exit code 5 with --wait. space machines show <machine> shows the error. Delete the machine and create it again; if it keeps failing, report the error and space version.

Machine out of memory or disk

A machine that ran out of memory shows as crashed; one whose disk is full fails writes. Give it more with space machines resize <machine> --mem <MiB> or --disk <GiB>, or with the Size tab of its Manage dialog in the portal (machines). A running machine restarts into its new size; its disk is kept.

Out of compute credits

Exit code 7 (HTTP 429): “Out of compute credits. Machines and agents can’t start or wake until more credits arrive”. The organization has used its compute credits for the month and has none bought, and the 7 days it keeps working after that are over; with --json the error’s details.out_of_credits is true. Buy credits under Plan & billing in the portal, or wait for the next month’s. Until then a machine can still be created asleep (space machines create --asleep), and browsers, git and storage keep working (Credits).

Not enough room to start a machine

Your organization’s plan allows so many vCPUs and so much memory for its running machines together. A machine that would pass that doesn’t start or resume. The portal shows this where you asked: in a chat, a terminal, a browser or canvas panel (when you press Wake on an agent that is asleep, or Resume on a suspended terminal or app, Resume now on a suspended browser), the machine’s Manage dialog, or the New machine dialog. It says how much is in use, what the machine needs, and what to do about it, with a link to Usage & limits. It also lists the two biggest running machines, each with Suspend. Suspend one of them and the portal tries yours again once that machine is suspended.

From the CLI the same refusal is exit code 7, for example quota exceeded: running memory 16384+1024 of 16384 MiB. Suspend a machine (space machines sleep <machine>) and try again, or create the new one with --asleep. If you often hit the limit, an admin of the organization can move it to a bigger plan.

Agents, Claude Code sessions, browsers and git have a count of their own instead (see Machines): quota exceeded: running agent machines 5+1 of 5 means five agents’ or sessions’ machines run already. Suspend one of them, or wait until one is suspended when it’s idle.

Rate limited (429) or region unavailable (502/503)

Exit code 7. Each key may make 600 requests per minute. Reads, including the polls of --wait, are retried up to 3 times, honouring the portal’s Retry-After; commands that change something are not, because they may have taken effect. In your own loops, wait between calls. A region that is unavailable is usually back within minutes; retry later.

--wait times out

Exit code 6. The command itself was accepted; the machine is still on its way. Check with space machines show <machine> and, if needed, raise --timeout.

SSH: Permission denied (publickey)

  • space ssh-keys list: is the key you use there? Only ed25519 and ECDSA keys work; RSA keys are refused.
  • Is it the key ssh offers? Try space ssh <machine> -- -v and look for “Offering public key” (without --, -v turns on space’s own verbose output instead). space ssh offers only a key that is registered on your account and found in your agent or as a default key in ~/.ssh (id_ed25519, id_ecdsa, …). For a key under another name, pass it: space ssh <machine> -i ~/.ssh/<key file>.
  • Are you a member of the machine’s organization?

SSH warns that the host key changed

If you connect with space ssh, the host key comes from the portal and is refreshed every time; this warning should not appear. With plain ssh it usually means the machine was deleted and re-created under the same name. Refresh the keys:

space ssh-config --write

If you copied the key into ~/.ssh/known_hosts yourself, remove the old line and take the new one from the machine’s Manage dialog in the portal (its Checkpoints tab). If the machine was not re-created, do not connect, and report it.

SSH: “the portal has no host key for machine … yet”

Exit code 1. The machine is still being created; its host key reaches the portal on its first boot. Wait for it (space machines create … --wait, or space machines show <machine>) and try again.

SSH: the first connection is slow

Connecting to a suspended machine resumes it first. Resume it in advance with space machines wake <machine> --wait.

SSH asks to accept the jump host’s key

Expected on the first connection to a region: the jump host’s key is not published yet (see Connect over SSH).

Reporting a problem

Send it to the team with space bugreport (or Feedback in the portal; --feature for a feature request). Include the command, its exit code and the error (with --json); the CLI adds its version. Never include your API key.

space bugreport "space machines wake dev --wait times out after 600 s; the machine shows running in the portal"

An agent inside a machine reports with space-env bugreport (Building blocks).

Last updated on