CLI
CLI exit codes
The exit codes of the lookio CLI and the API error codes behind each one, so a script can decide between retrying, fixing and stopping.
A script can branch on the exit code without reading a message.
| Code | Meaning | What to do |
|---|---|---|
0 | Success. | Continue. |
1 | A server, network or unexpected failure. | Retry later. If it continues, report it. |
2 | Bad usage, or a request that the API refused as not valid. | Fix the command. Do not retry it as it is. |
3 | Authentication or permission failure. | Sign in again, or ask for a wider scope. |
4 | Not found in this workspace. | Stop. The id does not exist here. |
5 | Rate limited. | Wait for Retry-After, then retry. |
6 | State conflict. | Read the state, then decide. |
7 | Out of credits. | Stop and tell a person. Do not retry. |
A resource of another workspace gives 4, like one that does not exist.
API errors and exit codes
| Exit code | API error codes |
|---|---|
1 | internal_error, service_unavailable |
2 | invalid_request, unknown_field, invalid_parameter, invalid_cursor, request_too_large, request_too_large_for_plan, method_not_allowed |
3 | authentication_required, invalid_api_key, api_key_expired, api_key_revoked, insufficient_scope, feature_not_available, admin_required, permission_denied |
4 | resource_not_found |
5 | rate_limited |
6 | conflict, assistant_has_no_resources |
7 | insufficient_credits |
insufficient_credits has its own code, 7, because a job without credits must stop and tell a person. A 402 with an unknown code also gives 7.
The CLI uses error.code first. For an unknown code, it uses the HTTP status.
Cancelled confirmations
When you answer “no” to a confirmation, the command exits 0.