メインコンテンツへスキップ

Errors and exit codes

Every dci command reports failures the same way: a single error message on stderr — with a hint when one is available — and a typed exit code that scripts and agents can branch on. You never need to handle raw HTTP responses.

Exit codes

Exit codeError codeWhen
0(success)The command completed successfully.
1CLI_ERROR / API_ERRORA failure not covered by a more specific class below.
2USAGE_ERRORInvalid usage: unknown command or flag, or missing/malformed arguments.
10AUTHENTICATION_FAILEDNot signed in, or the API token is malformed, expired, or revoked (HTTP 401).
11PERMISSION_DENIEDThe DoiT user or the active customer context lacks access (HTTP 403).
20RESOURCE_NOT_FOUNDThe requested resource does not exist (HTTP 404).
21RESOURCE_CONFLICTThe operation conflicts with the resource's current state (HTTP 409).
30VALIDATION_ERRORThe API rejected the arguments or payload (HTTP 400 or 422).
40API_SERVER_ERRORThe API failed to process the request (HTTP 5xx). Retryable.
41NETWORK_ERRORThe API was unreachable: DNS, connection, or timeout failure. Retryable.
50RATE_LIMITEDToo many requests (HTTP 429). Retry after the server-provided delay.

Retryable failures (API_SERVER_ERROR, NETWORK_ERROR, RATE_LIMITED) are safe to retry; rate-limited responses include the delay the server asked for.

Agent mode

In agent mode, errors are written to stderr as a JSON envelope instead of free text:

{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Alert not found",
"hint": "Check the identifier argument",
"retryable": false,
"http_status": 404,
"request_id": "7f2e0c9b1a"
}
}

Retryable failures also carry the server-provided delay when there is one:

{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests",
"hint": "Retry after the server-provided delay",
"retryable": true,
"http_status": 429,
"request_id": "a1b2c3d4e5",
"retry_after": "2s"
}
}
FieldTypeDescription
codestringStable error class, matching the table above.
messagestringHuman-readable description of what failed.
hintstringSuggested next step, when one is available.
retryablebooleanWhether retrying the same command may succeed.
http_statusintegerUnderlying HTTP status, when the failure came from the API.
request_idstringRequest correlation ID to include in support tickets.
retry_afterstringServer-provided delay before retrying, for rate-limited requests.