# Errors

> The shape of an error, every error code, and what to do about each.

An error has an HTTP status and a JSON body, in Firecrawl’s envelope:

```json
{
  "success": false,
  "code": "BAD_REQUEST",
  "error": "invalid request",
  "details": [
    {
      "loc": [
        "body",
        "url"
      ],
      "msg": "Field required",
      "type": "missing"
    }
  ]
}
```

`success` is `false`. `code` is one of the codes below, and it is the part to program against. `error` is a short sentence for a person. `details` is there when there is more to say, and its shape depends on the code: a list of the faults of a request for `BAD_REQUEST` (sometimes an object instead, such as `{"invalidURLs": [...]}`), and the name of the limit for `QUOTA_EXCEEDED`. An error never holds page content or a stack trace, and it never repeats what you sent.

The `404` and `409` answers of the crawl and batch routes have no `code`, so that the Firecrawl SDKs read them as they expect. They hold `error` only, as the page of each route says.

`NOT_IMPLEMENTED` is `400` on every route, except `POST /v2/extract` and `GET /v2/extract/{extract_id}`, which are not offered and always answer `501`. Use the [agent](https://darkcrawl.dev/docs/endpoints/agent/) there.

## Every code

| Code                               | Status | What it means, and what to do                                                                                                                                                                                                  |
| ---------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `BAD_REQUEST`                      | 400    | The request is not valid: an unknown field, a value of the wrong type or out of range, or an address that is not an address. `details` names each fault by its place. Fix it; sending it again unchanged gets the same answer. |
| `INVALID_ONION`                    | 400    | The address is not a valid v3 onion address. Check it for a typo. Old v2 addresses do not work.                                                                                                                                |
| `NOT_IMPLEMENTED`                  | 400    | The route or the option is one DarkCrawl does not offer. This is a 400 everywhere except on extract, which answers 501. Use what the message points to.                                                                        |
| `POLICY_FORBIDDEN`                 | 400    | DarkCrawl only reads onion addresses, and this request named something else. Do not send it again.                                                                                                                             |
| `UNAUTHORIZED`                     | 401    | The key is missing, wrong, revoked or belongs to a closed company, and every one of these gets the same answer. Check the `Authorization` header.                                                                              |
| `QUOTA_EXCEEDED`                   | 402    | A plan limit is used up. `details.limit` names it, and a daily limit has `resetsAt`. See Rate limits for what each one is.                                                                                                     |
| `BLOCKLISTED`                      | 403    | The address is on a blocklist, so the page is not read. Do not send it again.                                                                                                                                                  |
| `FEATURE_NOT_IN_PLAN`              | 403    | The request uses an option your plan does not include. `details.field` names it. Leave it out.                                                                                                                                 |
| `ORG_DISABLED`                     | 403    | Your company is disabled, and calls are refused until access is restored. Contact us.                                                                                                                                          |
| `ORG_SUSPENDED`                    | 403    | Your company is suspended, and calls are refused until it is resumed. Contact us.                                                                                                                                              |
| `SCRAPE_PROMPT_INJECTION_DETECTED` | 403    | The page looks written to take over an AI, and `checkPromptInjection` refused it. Do not pass its text to a model.                                                                                                             |
| `TRIAL_EXPIRED`                    | 403    | Your trial has ended, and calls are refused. Contact us to carry on.                                                                                                                                                           |
| `NOT_FOUND`                        | 404    | There is nothing at that address or id. Another company's object looks the same, so an id you do not own also answers this.                                                                                                    |
| `SCRAPE_LOCKDOWN_CACHE_MISS`       | 404    | The request asked for a stored copy only (`lockdown`) and there is none. Send the request without `lockdown`.                                                                                                                  |
| `SCRAPE_NO_CACHED_DATA`            | 404    | The request asked for a stored copy of a given age (`minAge`) and there is none. Send the request without `minAge`.                                                                                                            |
| `SCRAPE_TIMEOUT`                   | 408    | The time ran out before the page arrived. Onion sites are slow: send a longer `timeout`, or try again later.                                                                                                                   |
| `CONFLICT`                         | 409    | The request does not fit the current state: a job that has already finished, a monitor check that is already running, a paused monitor, or a channel that is still in use. Read the object, then decide again.                 |
| `GONE`                             | 410    | What you asked for was deleted, or its site was blocked since. Do not ask for it again.                                                                                                                                        |
| `PAYLOAD_TOO_LARGE`                | 413    | The body is bigger than is allowed: your plan's upload limit, or the size limit on a file sent to parse. Send less.                                                                                                            |
| `CONTENT_BLOCKED`                  | 422    | DarkCrawl does not return the page, for example because its body is over the size it reads (`response body too large`). Sending the request again does not change that.                                                        |
| `EXTRACTION_FAILED`                | 422    | The file could not be read, and `details.reason` says why, for example `unsupported`, `encrypted` or `malformed`. Send a different file.                                                                                       |
| `RATE_LIMITED`                     | 429    | Too many calls, or too many jobs running. Wait for the number of seconds in the `Retry-After` header, then send the call again.                                                                                                |
| `INTERNAL`                         | 500    | Something failed on DarkCrawl's side. The answer says nothing more, on purpose. Try again; if it keeps failing, contact us.                                                                                                    |
| `GATED`                            | 502    | The site answered with a queue or a CAPTCHA in front of the page, and DarkCrawl does not pass either. `details.gate` says which. Try again later.                                                                              |
| `ONION_UNREACHABLE`                | 502    | The site did not answer over Tor, or its certificate was refused. Try again later. For a self-signed certificate, send `skipTlsVerification` as `true`.                                                                        |
| `AI_UNAVAILABLE`                   | 503    | The request needs a model (an AI format, or the agent) and none is available right now. Try again later, or ask for a format that needs no model.                                                                              |
| `BLOCKLIST_UNAVAILABLE`            | 503    | DarkCrawl has not loaded its blocklist yet, and it does not answer without one. Try again in a minute.                                                                                                                         |
| `BROWSER_UNAVAILABLE`              | 503    | The request needs a browser (`render` set to `always`, or `waitFor` above zero) and none is available. Try again later, or leave `render` and `waitFor` out.                                                                   |
| `EXTRACTION_UNAVAILABLE`           | 503    | The part that reads documents is down or busy. Wait a moment and try again.                                                                                                                                                    |
| `SEARCH_UNAVAILABLE`               | 503    | Search cannot answer right now. `details.reason` says why. Try again later.                                                                                                                                                    |
| `SECRETS_UNAVAILABLE`              | 503    | DarkCrawl cannot store the address of a webhook or a Slack channel right now. Nothing was created. Try again later.                                                                                                            |
| `TOR_NOT_READY`                    | 503    | Tor is down or still starting. Try again in a minute.                                                                                                                                                                          |

## What to do

Read the status first.

- `400`: the request is wrong, or names something DarkCrawl does not read. Fix it. Sending it again unchanged gets the same answer.
- `401`: the key. See [Authentication](https://darkcrawl.dev/docs/api-reference/authentication/).
- `402`, `403`, `413`: your plan, or what it covers. `402 QUOTA_EXCEEDED` is a limit that is used up: `details.limit` names it, and a daily one says when it resets. `403` is a company that cannot work, a request for something outside the plan, or something DarkCrawl refuses, such as a blocked address. `413` is a body bigger than allowed. See [Rate limits](https://darkcrawl.dev/docs/api-reference/rate-limits/).
- `404`, `409`, `410`: the thing you named. It is not there, it is in a state the call does not fit, or it is gone for good. Read it again before you decide.
- `408`: the time ran out. Onion sites are slow. Send a longer `timeout`, or try again later.
- `422`: DarkCrawl would not return what it found. Sending the request again does not help.
- `429`: too many calls or jobs. Wait for the `Retry-After` header, then send the call again.
- `502`: the site, not DarkCrawl. It did not answer, or a queue or a CAPTCHA stands in front of its page. Try again later.
- `500` and `503`: DarkCrawl, for now. Try again after a short wait, a little longer each time. If a `500` keeps coming, contact us.

Retry only what a retry can change: `408`, `429`, `502`, `500` and `503`. A job that reads many pages keeps going when one page fails. The failed pages are in its errors, and the job’s reply says how it ended.
