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
| Code | Meaning | What to do |
|---|---|---|
| 0 | Success | Go on |
| 1 | Other error (Ctrl-C included) | Read the message; do not repeat it unchanged |
| 2 | Wrong usage: flag, reference, missing argument, or a confirmation needed without a terminal | Fix the command |
| 3 | Credential refused or expired, or the sign-in address does not match the pinned one | Stop and tell a person: wrong, revoked or expired key, or a locked account. tmspec auth login if it is a normal sign-in |
| 4 | Not allowed | Stop; do not look for a way around. With scope_missing, the key lacks a scope |
| 5 | Not found | Check the ref and the project. A spec you cannot read also reports "not found" |
| 6 | Conflict | Read code, see below |
| 7 | Input rejected | Read errors in the message, fix the file, send again |
| 8 | Try again later (429, 502, 503, 504) | Wait, then run the same command again |
| 9 | Network error: the server could not be reached | Run again later; for write commands, use the same --idempotency-key |
| 10 | propose --dir --dry-run found changes | Not an error; the plan is on stdout |
| 12 | The CLI is older than the minimum the server supports | Upgrade 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
code | Meaning | What to do |
|---|---|---|
base_moved | The spec has a newer version than the one you wrote your change on | Read 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_choice | Both your change request and the current version edit one part | tmspec cr update <n> --json to see Before, Latest, Yours, then choose (Propose a change) |
precondition_failed | The revision you read is stale | Read again (tmspec cr view <n>), then retry at the new revision |
idempotency_key_reused | The key was used with different content | If the first run may have succeeded, look for the change request it created; otherwise use a new key |
conflict | Another write to the same object is running at the same moment | Run the same command again with the same key (read the spec again first if it is a spec change) |
target_changed | link confirm or pin confirm: the target changed after the version you named | Look at the change (tmspec diff <ref>@<from>..<now>), then confirm at the new version |
link_cycle, target_retired, invalid_step... | The change itself is wrong | Fix 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.