code and next_action for
program behavior. Show error and next as plain text. Do not match the
wording of error or next.
Some responses add fields, such as
limit, reset_at, or
retry_after_seconds. The error codes table names them.
Handle an error response
- Read the HTTP status.
- Make sure that the body is JSON before you read
code. - Use the status and
codetogether to select the client branch. - Show
errorandnextas plain text. Do not render them as HTML or run them as commands. - Use
next_actionfor automatic recovery. If the client does not recognize the action, stop and show the error. - Keep the returned
limit,reset_at, andretry_after_secondsvalues with the failed request. - Before you retry, use the retry rules.
code. A proxy or network failure can
produce this result.
Do not replace a LogBrew code with the HTTP status name. For example, a
400 response can contain invalid_json or invalid_path. Each code needs a
different correction.
For logs, record the HTTP status and code. Do not log the full body,
credentials, or recovery tokens.
Error codes
The samecode can occur on more than one route. The next text and the
next_action values can change by route. Use the returned values. An
endpoint returns only the codes that apply to its authentication, method,
body, and limits.
An organization has no member limit and no project limit. The API does not
return
member_limit_exceeded.
An unknown ID and an ID that you cannot access can return the same response.
Do not use error text to find which account owns an ID. An unknown API path
returns 404 with not_found.
Limit fields
Read the current allowance and use from the
account API.
Retry rules
Use the code and the operation to decide on a retry. The status alone is not sufficient.- Do not start parallel retries for one failed request.
- For
rate_limited, the response also has theRetry-AfterandX-RateLimit-Afterheaders. Both contain the same number of seconds asretry_after_seconds. - An account can run at most 8 telemetry and log reads at the same time. A
further read waits up to 5 seconds for a free slot. Then it returns
429withrate_limitedand theRetry-Afterheader. Wait that long, then send the read again. - A timeout does not prove that the result is empty.
429. Keep their fields separate.
During either limit, show that collection or a read is delayed. Do not show
old data as the result of a new read.
Writes
A timeout, a5xx response, or a network failure does not prove that a write
failed. Before you send a write again:
- If the route supports an idempotency key, send the same key and the same body again. Use a new key only for new work.
- If the route has no idempotency key, read the resource first. Send the write again only if the change is not present.
- If you cannot find the result, stop automatic retries and tell the user.
An
Idempotency-Key value has 1 to 128 visible ASCII characters. Other values
return 422 with validation_failed.
idempotency_conflict means that the key belongs to a different request. Do
not change the body of a retry that uses the original key.
Request shape errors
invalid_json means that the server cannot accept the body as the route’s JSON
shape. Examine the content type, body size, JSON syntax, required fields, and
field types. The HTTP status shows which part failed:
validation_failed with the error invalid query parameters means that the
server cannot read the query string. Examine the parameter names and value
types. Do not send unknown query parameters. The
query filters reference lists the
parameters for each route.
invalid_path with status 400 means that a path value, such as a project ID,
has the wrong format. Do not move a path value into a query parameter.
A 500 response with invalid_path or invalid_multipart does not prove that
the request was wrong. Use the retry rules.
Authentication and access errors
unauthorizedmeans that account authentication is missing, invalid, or expired. SendAuthorization: Bearer <token>, or sign in again. Some routes returnnext_action.codeauthorize_requestwith a route-specificnext, such as a live feed connection without a valid ticket.ingest_key_invalidapplies to telemetry ingestion only. Configure a current key for the exact project.forbiddenmeans that the account cannot do the action. Do not retry with other resource IDs.not_foundmeans that the resource is not available to the account.
Keep error details safe
- An
account_recovery_availableresponse contains a short-livedrecovery_token. Keep it in protected client state. Do not put it in logs, URLs, screenshots, support reports, or agent prompts. - The
500codes always use the messageInternal error. The response does not name the component that failed. Do not guess the cause. - Do not add credentials, private diagnostics, or customer data to an error that you show.
- An API response does not give permission for a purchase, a deletion, or another account change. Get the user’s approval before those actions.
Examples
These examples show the envelope shape. Theerror and next text can be
different on each route.
Validation failure
Invalid query parameters
Invalid JSON
Invalid path value
Invalid multipart upload
Invalid WebSocket upgrade
Authentication failure
Invalid ingest key
This response applies to telemetry ingestion, not to account reads. The key must belong to the project in the request.Resource not found
Access denied
Unsupported method
Request timeout
Idempotency conflict
Rate limit
Usage limit
Thenext text and next_action depend on whether paid checkout is open.
Paid checkout is not open yet, so the response looks like this example. When
checkout opens, next_action.code is wait_or_upgrade and the target is
billing.
Artifact storage limit
Account recovery available
This response addsdeleted_at and a short-lived recovery_token. Keep the
token in protected client state.
Account recovery expired
Organization paused
Server error
storage_error, json_error, and internal_error use the same error
message. The code, next, and next_action values are different.
For endpoints, authentication, and filters, read the
Telemetry API.
