Skip to main content
Docs

Search guides and API endpoints, for example “Idempotency-Key” or “submit job”.

    Guides

    Handle errors

    Read problem details, decide what to retry, and handle the errors you're most likely to see.

    Updated October 1, 2026

    On this page

    Every error comes back as a problem detail with a status, a type, a readable detail, a request_id, and a retryability hint (Errors). Branch on status, type, and retryability, never on the wording of detail.

    A handler

    import httpx
     
     
    def check(response: httpx.Response) -> dict:
        if response.status_code < 400:
            return response.json()
        problem = response.json()
        kind = problem.get("type", "").rsplit("/", 1)[-1]
        hint = problem.get("retryability")
        message = f"{problem.get('status')} {kind}: {problem.get('detail')} (request {problem.get('request_id')})"
        if hint in {"upstream", "timeout"}:
            raise TemporaryError(message)         # retry with backoff
        if hint == "quota":
            raise QuotaError(message)             # wait, top up, or raise a limit
        if response.status_code == 422:
            raise InvalidRequest(message, problem.get("errors", []))
        raise PermanentError(message)            # fix the request or the credential

    With the Python SDK, errors are exceptions: BadRequestError (400), AuthenticationError (401), PaymentRequiredError (402), ForbiddenError (403), NotFoundError (404), ConflictError (409), ValidationError (422), RateLimitError (429), and ServerError (5xx), all subclasses of CogniChemError with status, code (the type slug), detail, request_id, retryability, and errors.

    Errors you'll meet

    You seeLikely causeFix
    400 missing-idempotency-keyAn API-key write without Idempotency-KeySend one (Idempotency)
    400 on submit with a wallet detailBalance minus reservations can't cover the estimateAdd funds, or wait for running work to finish
    400 on submit, duplicate namejob_name already usedChoose a new name
    401Key missing, wrong, revoked, or expiredCheck COGNICHEM_API_KEY, or create a new key
    403 insufficient-scopeA read key calling a writeUse a key with write
    403 spend-ceiling-exceededThe key's monthly ceiling would be passedRaise the ceiling or wait for next month
    403 with a monthly limit detailUtility or inference allowance used upWait for next month or change plan
    409Same idempotency key with a different body, or a request still in progressUse a new key for a new request; otherwise retry later
    413A file or request over the size limitUpload large files as artifacts and pass references
    422The request or payload failed validationRead errors; each tool's payload fields are on its tool page
    429Over the rate limitBack off for a minute
    5xxA temporary problem on our sideRetry with backoff; quote request_id if it persists

    Jobs that fail

    A job that ends error isn't an HTTP error: its status message says what went wrong (often bad inputs the tool couldn't process). Check the payload against the tool's fields, fix it, and submit again under a new job_name. Failed jobs are charged only for the time they ran (Jobs).