verify_document() raises typed exceptions for every failure mode. Each one carries an error_code and a docs_path so you can pattern-match in code and route users to the right help page from your own UI.
At a glance
| Exception | When it raises | Recoverable by code? |
|---|---|---|
VerifyDocumentArgError | You passed conflicting arguments (e.g. both prior_extraction and extraction). | No: fix the call |
VerifyDocumentLoadError | The document can’t be opened (corrupt PDF, unsupported format, LibreOffice missing). | Sometimes (retry with a different file) |
VerifyDocumentTooLargeError | Document exceeds 100 pages. | No: split the document |
InsufficientBalanceError | Account balance can’t cover the page-count cost. | Yes (top up + retry) |
ExtractionFailedError | Flow B provider returned malformed output. | Sometimes (try a different prompt / model) |
VerifyDepsMissingError | A required package isn’t installed (Pillow, pdf2image, provider SDK). | Yes: install the extra |
ManagedBackendError | Managed API rejected the request (auth, validation, schema mismatch). | Depends on error_code |
OSSServerError | OSS reviewer service returned a 4xx (auth or payload issue). | No: managed-side config bug, contact support |
OSSServerUnreachableError | OSS reviewer service unreachable (network blip, downtime). | Yes: retry |
VerifyTimeoutError | No reviewer submitted before timeout_seconds. | Yes: retry or extend timeout |
Detail per exception
VerifyDocumentArgError
Conflicting or missing arguments to verify_document(). The most common triggers:
- Passing both
prior_extraction=andextraction=(pick one: Flow A or Flow B). - Passing neither
document_path=nordocument_bytes=. - Passing both
document_path=anddocument_bytes=. response_schemaisn’t a PydanticBaseModelsubclass.
VerifyDocumentLoadError
The SDK couldn’t decode the document.
AWAITHUMANS_LIBREOFFICE_BIN.
VerifyDocumentTooLargeError
You hit the 100-page cap.
InsufficientBalanceError
Pre-flight balance check failed.
balance_cents: int: current balancerequired_cents: int: what the call needed (page_count × rate)error_code: str:"INSUFFICIENT_BALANCE"(stable for pattern-matching)docs_path: str:"insufficient-balance"(deep-link helper)
ExtractionFailedError
Flow B: the provider returned output that doesn’t validate against your response_schema, or the provider call itself failed (timeout, rate limit, etc.).
- Prompt is too vague; the model didn’t return all required fields. Tighten the prompt or simplify the schema.
- Provider rate limit or transient outage. Retry with backoff.
- Vision model picked a model name without vision support (e.g.
gpt-3.5-turbo). Use a vision-capable model.
VerifyDepsMissingError
A required package isn’t installed.
ManagedBackendError
The managed API returned a 4xx or 5xx response. The exception carries:
status_code: int: HTTP statusbody: str: raw response body (truncated to 500 chars)endpoint: str: which managed endpoint was callederror_code: str | None: managed’serror_codeif it was a structured errordocs_path: str | None: managed’sdocs_pathif provided
401:AWAITHUMANS_API_KEYis missing or invalid. Check the env var.402:InsufficientBalanceErroris the typed subclass; you shouldn’t see plainManagedBackendErrorhere.422: request body failed validation. The error message will name the field.5xx: managed-side issue. Retry; if persistent, check status.awaithumans.dev.
OSSServerError / OSSServerUnreachableError
The managed service couldn’t reach or got a 4xx from the reviewer dashboard backend.
OSSServerUnreachableError: transient network issue between managed and OSS. Safe to retry; the original task is rolled back, so retry creates a fresh one.OSSServerError: non-transient (auth misconfiguration, schema mismatch). Indicates a managed-side bug. Contact support. Your retry won’t help.
VerifyTimeoutError
No reviewer submitted before timeout_seconds elapsed.
verify_document() again with the same arguments to re-submit; the new task is independent.
The default timeout_seconds is 48 hours, with a maximum of 30 days. Configure shorter timeouts for tasks that have business deadlines.
Pattern-matching by error_code
For UI that surfaces our errors to your users, use the stableerror_code strings rather than parsing exception messages:
Debugging without leaking content
When you log averify_document() failure, log:
error_codetask_id(if the exception carries one)status_code(forManagedBackendError)- The exception class name
- The
document_bytes - The
prior_extraction(it may contain PII before the human review even ran) - The full exception
__str__()if you’re not sure what’s in the body field
Where to go next
Pricing
How balance + the InsufficientBalanceError prevent surprise charges.
Security
Why our exception messages and our audit log never carry response content.