Skip to main content
For hosted API refusals, branch on the error’s stable code. Keep requestId / request_id when reporting a problem. Looking up a specific failure? The error code reference explains every known code and its next step. Examples reuse the SDK setup. Set jobId / job_id to an existing job ID and run Python snippets inside an async function.

Catch an API refusal

isKnownCode() / is_known_code() checks this SDK’s known code list. HOSTED_ERROR_CODES and isHostedErrorCode / is_hosted_error_code are exported. Meta publishes the deployment’s current list.

Common next actions

An unknown code is still an API error. Do not replace it with a guessed classification.

Failures outside the API error class

A failed import is usually a returned import with status: FAILED and failure. That is different from failing to read the import over HTTP.

Retry the right thing

The SDK does not blindly retry every write. Use idempotency keys on supported job operations. Aborting a watch stops waiting; it does not cancel the remote work.
Last modified on November 9, 2026