Skip to Content

Errors and retries

An error can mean the request was not accepted, a temporary request failed, or document processing finished without all of its content. Start with the error code and the job's current state before deciding to submit the file again.

Read an SDK error

The SDK exposes PageletError. It includes a code and message, plus the HTTP status, requestId, and details when available.

import { Pagelet, PageletError } from "@pagelet-ai/sdk"

const client = new Pagelet()

try {
  const result = await client.documents.create({ file: "statement.pdf" })
  console.log(result.document.id)
} catch (error) {
  if (!(error instanceof PageletError)) throw error
  console.error(error.code, error.message, error.requestId)
}

Save the request ID when reporting an API problem. Do not include API keys or webhook secrets in logs or support messages.

Choose the next action

Error codeWhat to do
invalid_requestCorrect the request. Validation details identify affected fields.
unauthorizedCheck the key and target environment.
forbiddenCheck key permissions and workspace feature access.
not_foundCheck the ID, workspace, and whether the content is still retained.
capacity_exceededWait before trying again. For Search, check your workspace's search limits.
tenant_page_allowance_exceededCheck the workspace's allowance and plan.
upload_too_largeUse a file within the upload limit.
upload_expiredStart a new upload; the old upload can no longer be confirmed.
result_not_readyCheck the existing job later; do not upload another copy.
search_unavailableSearch is temporarily unavailable. Try again after a short wait.
webhook_not_configuredSet up webhook signing, or disable notification for that submission.
idempotency_conflictUse the original request with that key, or a new key for genuinely new work.
idempotency_key_expiredReconcile the original submission before choosing a new key.

document_transfer_failed, request_failed, and request_timeout describe SDK request or transfer failures. Inspect the available status and the existing submission before choosing recovery.

Automatic retries

The SDK retries eligible temporary failures up to two times after the first attempt. API retries cover transport failures and HTTP 408, 500, 502, 503, and 504. File transfers also handle temporary conflicts according to the upload protocol.

The SDK does not automatically retry 429 responses or result_not_ready. Your application chooses when to retry a capacity or Search-limit response. A status read and a result read do not become polling loops.

Avoid duplicate submissions

For your application's retries of the same submission, keep the same idempotencyKey and request. If you omit the key, the SDK generates one for that call and keeps it through its own retries. Calling creation again without preserving the key is a new submission.

An application reference such as externalId is useful for correlation, but it is not a deduplication key.

Recover after waiting ends

A completion timeout or local cancellation does not cancel processing already admitted by the service. A completion_timeout error carries the job ID in details.job_id; use it to check progress and retrieve the result. If your application needs to persist the ID before processing finishes, start with jobs.create.

A processing job can finish with warnings or have an inspectable result despite failure. Check result_available, then inspect page warnings and nullable content. See Read and use results.

On this page