Skip to content
Komando

Results and errors

How komando answers, what the exit codes mean, how to fix common errors, and how to see what is still running.

Read a result

komando exec web1 -- uptime              # readable text in a terminal
komando exec web1 -o json -- uptime      # one JSON object (what agents get)
komando status                           # VPNs, logins, tunnels and jobs still running
komando doctor                           # check the local setup

In a terminal you get readable text. When another program (such as an AI agent or a script) runs komando through a pipe, it gets one JSON object instead. Force either with -o text or -o json, or set KOMANDO_OUTPUT. --pretty indents the JSON.

An agent or script that only wants to read what ran on a server can ask for text too: komando exec web1 --read-only -o text -- cat /etc/hosts prints the server's output as it is. komando's exit code stays its own (5 when the command exits non-zero), not the command's. With several servers, each one gets a block headed === web1 [ok, exit 0] (or [failed: exit 1], [skipped] ...). Use JSON when you need each server's exit code or error as data.

Text from servers, databases and pods is made safe for your terminal first: colours stay, but escape sequences that move the cursor, set the window title or write the clipboard, hidden text (ESC[8m), other control characters and bidi overrides (U+202E, which shows text in another order than it runs) are printed as \e, \xNN and \u202e. A carriage return stays, so progress bars work, except on a line that starts with a server's or pod's name ([web1] ...): there it shows as \r, so a server cannot print over the name. In JSON, data keeps the bytes as they are, escaped the JSON way: it is the file, the row or the output itself. The words komando writes about a result are made safe there too, because whoever reads the JSON shows them to a person: error.message, error.hint and error.suggestion (also in the error objects of a result, one per server), meta.warnings, meta.skipped, meta.would_be_blocked and the name and detail of doctor's checks. Invisible format characters (zero-width spaces, word joiners, tag characters) show as \uNNNN there too. This is for display: it changes the text, so compare codes, not messages.

{
  "ok": false,
  "command": "exec",
  "data": {
    "command": "uptime",
    "results": [ { "host": "web1", "ok": false, "exit_code": 3, "stdout": "", "stderr": "…" } ],
    "summary": { "total": 1, "ok": 0, "failed": 1, "failed_hosts": ["web1"] }
  },
  "error": { "code": "FAILED", "message": "server web1 failed", "hint": "…" },
  "meta": { "contract": 2, "version": "…", "duration_ms": 211 }
}
FieldMeaning
oktrue only when everything succeeded
commandthe command's ID: its words joined by dots (exec, db.query, fs.list, secret.show). komando audit --command takes the same IDs
datathe result. Commands that run on many servers use data.results[] (one per server) and data.summary. Each result names its server in host (exec, facts, test, cp ...)
error{code, message, hint} when ok is false. data can still be there when servers failed (PARTIAL_FAILURE)
error.suggestionfor a typo: the name komando thinks you meant (a command, a server, a flag). The hint is then the whole command line with it in place. A word from another tool (ps, kubectl, psql) gets the komando command that does that job. Left out otherwise
error.hintalways says what to try next. Most codes give their own hint; when one gives none, komando puts in a general hint for the exit code (for example, exit 7 suggests --timeout or komando job start)
nullkomando could not find out (for example facts without the rights to read something). It never stands in for 0 or false
metacontract, version, duration_ms; dry_run and would_be_blocked on a dry run, would_need (every approval flag the real run needs) and not_simulated (steps the dry run could not try without making them, such as a MySQL DDL statement or sqlite's VACUUM); skipped when the target picked things this command cannot use, with the reason (also when the command then fails); host_keys_pinned when the command trusted a server's SSH host key for the first time (host, address, key_type, fingerprint), for the person to compare with the server's own; truncated when a list stopped at --limit and there is more (--limit 0 shows all); body_sha256 when the command sent a script or content: its full SHA-256, whose first 16 hex characters the approval window shows (what each command's hash covers)

Exit codes

CodeMeaningExamples
0success
1general errorAUDIT_UNAVAILABLE
2wrong command, flag or valueUSAGE, HIDDEN_VALUE, NEEDS_TERMINAL
3not foundTARGET_NOT_FOUND, FILE_NOT_FOUND, TOOL_MISSING, SECRET_NOT_FOUND, SECRET_UNRESOLVED
4cannot connect or log in, or the connection brokeAUTH_FAILED, NO_AUTH, HOSTKEY_MISMATCH, VPN_LOGIN_REQUIRED, CONNECTION_LOST
5the command failed on the serverFAILED, ROLLOUT_FAILED
6blocked for safetyPOLICY_BLOCKED, PROTECTED_TARGET, WRITE_REQUIRES_FLAG, DECLINED
7timed outTIMEOUT, CONNECT_TIMEOUT (the server did not answer within --connect-timeout), ROLLOUT_TIMEOUT
8a precondition failed or something is in the wayNO_MATCH and AMBIGUOUS_MATCH (fs replace text not found or not unique), PORT_IN_USE, FILE_TOO_LARGE, KEY_EXISTS

When several servers fail, the exit code is the worst one. The full machine-readable reference is komando schema; komando help exit-codes and komando help output print a short version at the terminal.

What is still running, and where am I?

komando status lists the VPNs, logins, tunnels and jobs still running (see See what is still running), and the line komando prints before shell and similar commands is in Where am I?.

Will my scripts keep working?

Every JSON answer has meta.contract. Within a contract, komando only adds fields, error codes and exit codes to the JSON envelope; it never renames or removes them. Command and flag names are not part of the contract: komando is used internally for now, so a renamed command or flag keeps no old name, and the changelog lists each one. If the envelope ever has to change, meta.contract goes up and the changelog says what changed.

Reference: komando schema

komando schema exec                      # every flag of exec, machine-readable
komando schema secret.show               # a command by its ID, as the JSON names it
komando schema                           # also every exit code and error code

Each command in komando schema has a kind (read, change or depends) and a confirm list from komando's rule table: first the tier it always has, then each tier it reaches only sometimes, with the flag an agent or a script adds and when, for example [{"tier":"change"},{"tier":"dangerous","flag":"--allow-dangerous","when":"with --remove-home"}]. Tiers are read, change, dangerous (--allow-dangerous), safety (--yes) and person (no flag: a person at a terminal runs it). A change on a protected server or conn also needs a yes; the target decides that, so it is not listed. See What needs a yes.

The add commands also list the kinds they take, under add_kinds, so a program can build its add forms from them. komando schema vpn add gives each VPN kind its id, display_name, family (portal, config_file, server_psk, auth_key, system or proxy), aliases, the flags it needs (required, and one_of: groups where one flag is enough), the flags it may take (optional), flag_notes, and opens_browser: whether vpn up opens a browser to sign in (browser_note says when). komando schema conn add (and db add, cache add, queue add, storage add, cluster add, registry add for their own kinds) gives each conn kind its id, display_name, family, url_schemes, url_example, default_port and the same flag lists. They come from the same table as komando vpn add --help and komando conn kinds.

Troubleshooting

The table below has the errors people meet most. Every code komando gives, with its exit code, an example message and the usual next step, is in Error codes, and in komando schema under error_codes:

komando schema -o json | python3 -c 'import json,sys; [print(c["code"], c["exit"], c.get("example","")) for c in json.load(sys.stdin)["data"]["error_codes"]]'

For a stop for safety (exit 6): at your terminal komando asks you first; an AI agent or a script adds --yes (or --allow-dangerous) after a person agrees. See Safety.

ErrorUsually meansTry
AUTH_FAILEDwrong user, key or password; or the server asks for a two-factor code and no person is at a terminal to answer it (the message quotes its question)komando host show NAME; a changed password: komando secret set NAME; a two-factor login: komando login NAME once in your terminal (it asks the code and keeps the login, 8h; an AI agent asks the user to run it)
NO_AUTHthe server has no key, identity or password, ssh-agent holds no key, and no person is at a terminal to type a password (the message says if ~/.ssh/id_ed25519 is encrypted and not loaded)ssh-add (or ssh-add ~/.ssh/id_ed25519), or save a password: komando secret set NAME, then komando host edit NAME --password-ref secret:NAME (or --key KEY); start ssh-agent first if SSH_AUTH_SOCK is not set
KEY_PASSPHRASE_REQUIREDthe server's key (--key or --identity) is encrypted, has no passphrase in the vault, and ssh-agent does not hold it (komando uses the agent's copy, as ssh does)ssh-add PATH, or store the passphrase: komando secret set NAME, komando key add NAME PATH --passphrase-ref secret:NAME, then komando host edit HOST --key NAME --unset identity (for a --key key: komando key edit NAME --passphrase-ref secret:NAME)
KEY_EXISTSkey gen, key add or key rename to a key name that is takenchoose another name, or komando key rm NAME first
CONNECTION_REFUSED, CONNECT_TIMEOUT, DNS_ERRORthe server is down, the address or port is wrong, a firewall drops the connection, or nothing listens on the portkomando host show NAME to check the address and port; a slow link: --connect-timeout 30s; a private server: add --via BASTION or a VPN
HOSTKEY_MISMATCHthe server was rebuilt, or someone is intercepting; the message shows the pinned fingerprint and the one the server shows nowcompare the new fingerprint with the server's console or your provider first, then komando host trust NAME --reset in a terminal, or @group for many at once (only a person replaces a key; an agent reports it and gets NEEDS_PERSON)
HOSTKEY_UNKNOWNhost keys are strict and this server's key is not pinned yet; the message shows its fingerprintcompare it with what the server's owner sees, then komando host trust NAME
HOSTKEY_REVOKEDthe server shows a host key on komando's list of revoked keystreat the server as compromised and tell its owner; nothing was sent
SECRET_UNRESOLVEDthe stored password or environment variable is missingkomando secret list
SECRET_IN_USEsecret rm of a secret that something still usespoint them elsewhere, or rename it with komando secret rename OLD NEW
SECRET_EXISTSsecret rename or secret cp to a name that is taken; vpn add whose keys would go into a secret that exists (NAME-key, NAME-psk, NAME-config) and is not that VPN's ownpick another name, or add --overwrite (secret rename, secret cp); for vpn add, pick another VPN name or move the secret away with komando secret rename
SECRET_MISMATCHsecret check: the value entered is not the stored onedata.difference says how they differ; komando secret set NAME stores the right one
NAME_TAKENa new name (from host rename, rename --starts-with, ...) is used already; for rename the message lists every clash, and nothing was renamedpick other names, or rename or remove what is in the way; --dry-run shows the whole list first
NOTHING_TO_RENAMErename --starts-with: no name starts with OLDcheck the spelling and case with komando list and komando secret list
GROUP_EXISTSgroup rename to the name of another grouppick another name, or merge them: komando group add NEW @OLD, then komando group rm OLD
sudo: a password is requiredsudo needs a passwordkomando secret set NAME, then komando host edit HOST --sudo-ref secret:NAME
VPN_LOGIN_REQUIREDthe VPN needs a person's login (MFA)a person runs komando vpn up NAME once
AWS_LOGIN_REQUIREDthe AWS SSO login has expireda person runs komando login aws --profile NAME
AZURE_LOGIN_REQUIREDno Azure login was found (for an Azure Container Registry)set a service principal (AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET), run on Azure with a managed identity, or a person runs az login
GCP_LOGIN_REQUIREDthe Google login has run out (for Google Artifact Registry)a person runs gcloud auth application-default login, or set GOOGLE_APPLICATION_CREDENTIALS to a key file
POLICY_BLOCKEDthe command looks destructivedouble-check it; at your terminal you type the name of what goes, a script adds --allow-dangerous
PROTECTED_TARGET, PROTECTED_TARGETa change to something marked protectedat your terminal komando asks; a script adds --yes
SAFETY_SETTINGa change that turns a seatbelt offat your terminal komando asks; a script adds --yes
SECRET_DESTINATIONan AI agent asked to send a secret somewhere new ({{secret:NAME}}, --env K=secret:NAME, a password on a new address)tell the user which secret goes where; once they agree, add --yes
NEEDS_PERSONsomething only a person can do: type a password (secret set, --ask-password, a --login ask server), log in (komando login), compare a secret with secret check, set the approval code. An AI agent and a script get it alikeask the user to run the command in their own terminal; no flag lets a program do it
DECLINEDa person answered no to komando's questionnothing was changed; run it again to be asked again
WRITE_REQUIRES_FLAGa database, cache or cluster command that changes data--write --dry-run, then --write
SENSITIVE_FILEan AI agent tried to copy a secret file (.env, a private key) hereread it with komando fs cat (values hidden); a person may allow --reveal
HIDDEN_VALUEthe text holds [hidden] or [secret:NAME]change one line with fs replace; set a secret with {{secret:NAME}}
NO_MATCHING_TARGETSthe target picked only things this command can't usefollow the hint (for example, use komando db for a database)
TARGET_NOT_FOUNDa typo in a server, conn or VPN name, whatever the commandthe hint suggests the closest match; komando list
TARGET_EMPTYa group, tag or pattern picked nothingkomando list GROUP shows what it picks
VAULT_LOCKED, VAULT_DECRYPT, VAULT_KEYthe vault cannot be opened: no passphrase, a wrong one, or its key is gonesee Secrets; komando doctor says which
IMPORT_INCOMPLETEan import brought most things in but refused some (see skipped)fix those entries in the file and import again
PARTIAL_FAILUREthe command ran on several servers and at least one failed (with one server you get that server's own code, such as CONNECTION_REFUSED, or COMMAND_FAILED when its command exited non-zero)read data.results for each server's exit code and stderr
USAGEa wrong command, flag or value; also komando alone or a group such as komando db without its sub-command, when pipedthe message says what is wrong, often with "did you mean"; the hint gives an example or lists the sub-commands
PORT_IN_USEthe local port is takenpick another port, or 0 for a free one
NEEDS_TERMINALan interactive command (shell) run by a programagents use exec, cluster exec or job
CONNECTION_LOSTthe link broke while the command ran; it may still be running, or may have finishedcheck with a read-only command before running it again; use komando job start over a shaky link (details)
TIMEOUTthe command took too long--timeout 30m, or komando job start for long work

komando doctor checks your local setup, the inventory and its security.

In -o json, a doctor check that one komando command puts right has fix: the words to run, as a list (["komando", "conn", "edit", "db2", "--protected"]). The detail says the same in prose. A program that offers the fix reads fix and never takes a command out of detail. A check has fix only when one command puts it right whatever else is true, and that command asks nothing: a check with several ways out, one that needs a value or a passphrase from you, one only you can judge (two conns that look the same), or a name that could be read as a flag, has none.

Source: docs/features/output.md in sgnd/komando at commit b622784.