Output and reference

Handle errors

An API error prints one line with the status, then the error type and code in brackets as [type/code] (only the parts Drex sent), the message and the request_id. Below it come up to five fields that failed validation, from the error's issues or detail.errors, then (+N more):

error: 422 [invalid_request_error/invalid_request] The request does not match the schema for this method. See detail.errors for the fields that failed. (req_...)
  - output.formats.0: Input should be 'markdown', 'text' or 'blocks'

A 402 adds Top up or add a card at <your Drex host>/dashboard/billing, or Pay the unpaid invoice at <your Drex host>/dashboard/billing when its type is payment_required, a 409 path_conflict adds how to upload anyway, 409 session_busy, 429 rate_limited and 403 access_denied add what to do next, and a 503 job_pending adds Rerun the same command with --idempotency-key <key> to resume it, naming the key the run sent. The error types are in Errors.

On the document commands:

What happenedWhat you seeExit
A request the document service refused, such as an unsupported file type or an unknown fielderror: 422 [invalid_request_error/<code>] ..., then up to five fields from the error's detail.errors. See Errors.1
A different file at an upload path409 path_conflict, and a line naming --upload-path (--path on nace upload) and --on-conflict new_version. From 32 MiB, error: Upload did not finish: ... (path_conflict: ...).1
The same --idempotency-key with a different body409 idempotency_conflict.1
A create whose job isn't confirmed yet503 [service_unavailable/job_pending], and a line with the key the run sent: Rerun the same command with --idempotency-key <key> to resume it. The job may be running and billed; the same key and body return it.1
A create while the balance isn't positive and no card pays for usage beyond it402 [insufficient_credit], and Top up or add a card at <your Drex host>/dashboard/billing.1
A create while the account has an unpaid invoice402 [payment_required], and Pay the unpaid invoice at <your Drex host>/dashboard/billing.1
A job you waited for failed or was cancellederror: [<code>] job <id> <status>: <message>.1
The wait ran past --wait-timeouterror: job <id> still <status> after <N>s; read it later with ... on stderr, and the job id on stdout (the whole job with -o json). The job keeps running.1
Content still being prepared after --wait-timeout, or content that couldn't be preparedAn error naming the job and path, or 409.1
Input nace refuses before any request: an http:// or missing SOURCE, --file-name without an https:// SOURCE, a job: SOURCE on classify, with -p on parse or extract, or with --mode medium or high or --password, both or neither of -s and --schema-id, a --limit out of range, a workspace command with no workspace to useerror: ... on stderr, nothing on stdout.2