Exit codes and JSON output
Exit codes and JSON output
Exit codes
| Code | Meaning | Typical cause |
|---|---|---|
| 0 | Success | |
| 1 | Other error | I/O error, unexpected response or redirect from the portal |
| 2 | Usage or configuration | Bad flags, no key, no organization chosen, config file readable by others |
| 3 | Not authenticated or not allowed | HTTP 401 (missing, unknown, revoked or expired key) or 403 |
| 4 | Not found | HTTP 404: no such machine, checkpoint, organization or SSH key |
| 5 | Rejected or failed | HTTP 400, 409 or 422; a machine or checkpoint ended in failed |
| 6 | Timeout | --wait ran past --timeout |
| 7 | Unavailable | HTTP 429 or 5xx (after retries for reads), network error or timeout |
space ssh is the exception: it exits with ssh’s status.
Output streams
- Data goes to stdout: tables for lists,
key: valuelines for one object. - Messages, progress and errors go to stderr. Without
--json, an error iserror: <message>, followed by ahint:line for 401 and 403. - Wait progress (
dev: creating…) is shown only when stderr is a terminal. - No colours yet.
JSON output
With --json, stdout holds the portal API’s object, pretty-printed, without the
envelope: space machines show dev --json prints the machine, space machines list --json the list of
machines. Field names and values are the API’s, so they do not change with the CLI’s table
layout.
A machine:
{
"id": "0b7c6f9e-3c1d-4a51-9f0e-2d5a8c1e7b44",
"name": "dev",
"state": "running",
"vcpus": 2,
"mem_mib": 2048,
"disk_gib": 10,
"base": null,
"error": null,
"ingress_mode": null,
"ingress_port": null,
"ssh_host_keys": ["ssh-ed25519 AAAA…"],
"created_by": "user:3f1c8a52-7d4e-4b9a-8c21-5e6f7a8b9c0d",
"on_behalf_of": "user:3f1c8a52-7d4e-4b9a-8c21-5e6f7a8b9c0d",
"created_at": "2026-11-06T10:00:00Z",
"updated_at": "2026-11-06T10:00:04Z"
}Errors go to stderr as one line of JSON:
{"error": {"code": "invalid", "message": "…", "details": {"name": ["has already been taken"]}}}code | HTTP | Exit |
|---|---|---|
bad_request | 400 | 5 |
unauthorized | 401 | 3 |
forbidden | 403 | 3 |
not_found | 404 | 4 |
conflict | 409 | 5 |
invalid | 422 | 5 |
rate_limited | 429 | 7 |
region_unavailable | 502, 503 | 7 |
Errors that do not come from the portal use the same shape with their own codes:
code | Exit | Meaning |
|---|---|---|
usage | 2 | Bad flags or configuration |
network | 7 | Could not reach the portal |
failed | 5 | A machine or checkpoint ended in failed |
timeout | 6 | --wait ran past --timeout |
error | 1 | Anything else (exit code 1) |
Last updated on