Errors

How an error looks in the CLI and in --json, and where every error code is explained.

In the terminal

A command that cannot do its work prints one line on stderr: the problem's detail, then its code and request id in brackets when the API answered. A next: line follows when the fix is one command (ciresk ci auth login, ciresk ci init, the policy field that lifts a spent budget). The exit code is the one from Exit codes. A failed job is not an error: the summary prints and the exit code is 1.

A policy refusal
error: Full builds are off for this repository (policy_denied, request req_0199f3c2a7b84e1d9c5a3f6e8b2d4a10)

In --json

Errors use the same envelope as every other output, with error instead of data. error is the API's problem document: type, title, status, code, detail, request_id and the code's own fields.

--json
{
  "schema_version": 1,
  "command": "run",
  "request_id": "req_0199f3c2a7b84e1d9c5a3f6e8b2d4a10",
  "error": {
    "type": "https://docs.ciresk.com/errors/policy_denied",
    "title": "Denied by policy",
    "status": 403,
    "code": "policy_denied",
    "detail": "Full builds are off for this repository",
    "request_id": "req_0199f3c2a7b84e1d9c5a3f6e8b2d4a10",
    "policy_field": "allow_full_build",
    "trust": "trusted_interactive"
  },
  "budget": null,
  "next": null,
  "truncated": false
}

Every code

The codes, their HTTP status, the exit code each maps to and what to do are in API errors. The type URL of every problem, https://docs.ciresk.com/errors/<code>, lands on that page. Include the request_id when you report a problem.

Local errors

A few errors never reach the API and carry no request_id: no manifest where one is needed (ciresk ci init writes one), a tree over its limits (the message names .ciresk/ignore) and a token that is missing from both the keychain and CIRESK_TOKEN. They exit 2 or 3 and the message names the fix. When the CI plugin itself is not installed, ciresk ci names ciresk update as the fix and exits 127.