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'

Some errors add a line on what to do next:

  • 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.
  • A 503 job_pending adds Rerun the same command with --idempotency-key <key> to resume it, naming the key the run sent.
  • 404 workspace_not_found, 409 session_busy, 429 rate_limited and 403 access_denied add what to do next.

The error types are in Errors.

On the document commands

Exits 1: the request or the job failed.

What happenedWhat you see
The document service refused the request, such as for 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.
A different file is already at the upload path409 path_conflict, then how to upload anyway: another --upload-path (--path on nace upload), or --on-conflict new_version. From 32 MiB: error: Upload did not finish: ... (path_conflict: ...).
The same --idempotency-key with a different document-tool body409 idempotency_conflict. For workspace jobs, reuse a key only for identical inputs; changed inputs may replay an earlier job or be rejected with a different error code.
The job isn't confirmed yet503 [service_unavailable/job_pending], then 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.
No available funds: the balance isn't positive, and no card pays for usage beyond it402 [insufficient_credit], then Top up or add a card at <your Drex host>/dashboard/billing.
The account has an unpaid invoice402 [payment_required], then Pay the unpaid invoice at <your Drex host>/dashboard/billing.
A job you waited for failed or was cancellederror: [<code>] job <id> <status>: <message>.
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.
Content is still being prepared after --wait-timeout, or couldn't be preparedAn error naming the job and path, or 409.

Exits 2: nace refused the input before any request. Stderr shows error: ..., and stdout stays empty. For example:

  • An http:// or missing SOURCE, or --file-name without an https:// SOURCE.
  • A job: SOURCE on classify, or with -p on parse or extract, or with --mode medium, --mode high or --password.
  • Both or neither of -s and --schema-id.
  • A --limit out of range.
  • A workspace command with no workspace to use, when the account doesn't have exactly one. Listing them is its only request.

On this page