Skip to main content

Exit codes

Every tmspec command exits with a code that says what happened. Scripts and agents should branch on this code, then read the error's code on stderr (with --json, the error is a problem+json). code is stable across releases; detail is wording for people and may change.

The table​

CodeMeaningWhat to do
0SuccessGo on
1Other error (Ctrl-C included)Read the message; do not repeat it unchanged
2Wrong usage: flag, reference, missing argument, or a confirmation needed without a terminalFix the command
3Credential refused or expired, or the sign-in address does not match the pinned oneStop and tell a person: wrong, revoked or expired key, or a locked account. tmspec auth login if it is a normal sign-in
4Not allowedStop; do not look for a way around. With scope_missing, the key lacks a scope
5Not foundCheck the ref and the project. A spec you cannot read also reports "not found"
6ConflictRead code, see below
7Input rejectedRead errors in the message, fix the file, send again
8Try again later (429, 502, 503, 504)Wait, then run the same command again
9Network error: the server could not be reachedRun again later; for write commands, use the same --idempotency-key
10propose --dir --dry-run found changesNot an error; the plan is on stdout
12The CLI is older than the minimum the server supportsUpgrade the CLI (Install)

Code 11 is unused. Codes are only ever added, never renumbered. tmspec --help prints the same table.

Automatic retries​

Read commands (GET) and write commands that carry an Idempotency-Key are retried by the CLI up to 3 times on a network error, 429, 502, 503, 504 or a write colliding at the same moment (conflict), waiting according to Retry-After for at most 60 seconds. A line such as retrying in 5s (503 Service Unavailable) shows on stderr. Other write commands are sent only once. If you get code 8 or 9, the CLI has already tried enough; wait, then run again.

Write commands and an unknown result​

A network error or Ctrl-C after sending can happen when the command has already finished on the server. Then the error prints Result unknown together with the key to use:

tmspec propose --file change.yaml --idempotency-key <key>

Running again with exactly the same key and file makes the server return the first result instead of doing it twice. For a write command with no key (for example tag remove), the message only gives you a read command to check with before you run it again.

Code 6: conflict​

codeMeaningWhat to do
base_movedThe spec has a newer version than the one you wrote your change onRead the spec again, redo the change on the new version and propose again. For an existing change request of your own: tmspec cr update <n>
needs_choiceBoth your change request and the current version edit one parttmspec cr update <n> --json to see Before, Latest, Yours, then choose (Propose a change)
precondition_failedThe revision you read is staleRead again (tmspec cr view <n>), then retry at the new revision
idempotency_key_reusedThe key was used with different contentIf the first run may have succeeded, look for the change request it created; otherwise use a new key
conflictAnother write to the same object is running at the same momentRun the same command again with the same key (read the spec again first if it is a spec change)
target_changedlink confirm or pin confirm: the target changed after the version you namedLook at the change (tmspec diff <ref>@<from>..<now>), then confirm at the new version
link_cycle, target_retired, invalid_step...The change itself is wrongFix the change; running it again unchanged does not help

Code 12: the CLI is too old​

Each server declares the oldest CLI it supports. An older CLI stops before doing anything, with code 12 and a reminder to upgrade. Details are in CLI and server compatibility.