Errors and retries
Retry transient failures without duplicating work or hiding bad requests.
Read the JSON body on every scrape response, including HTTP errors. Use scraped content when success is true. When success is false, use code to choose the next action and message to explain the outcome.
| Status | Meaning | Action |
|---|---|---|
200 | Scrape result, including a failed outcome from the target or a scrape deadline | Check success before reading data |
400 | Invalid request or target hostname could not be resolved | Check the code and DNS retry guidance below |
401 | Missing, invalid, or revoked API key | Replace or rotate the key |
402 | INSUFFICIENT_CREDITS | Restore the workspace balance before retrying |
404 | Unknown job or route, or transcript unavailable | Check the identifier, route, or caption availability |
409 | Conflicting state | Read current state before another write |
429 | Request rate exceeded, scrape queue full, or queue wait timed out | Back off with jitter and reduce concurrency |
502 | Gateway could not deliver an API response | Back off and retry safe requests |
503 | Required browser, proxy, AI, or storage dependency unavailable | Retry later or use a cheaper compatible mode |
504 | Gateway timed out waiting for the API | Back off and retry safe requests |
A DNS lookup failure returns HTTP 400 with code: "TARGET_DNS_UNRESOLVED". When retryable is false, check the hostname or use a different source. When it is true, retry later with backoff. The lookup happens before the scrape and uses zero credits.
Failed scrape outcomes
Berrycrawl returns HTTP 200 for outcomes such as missing content, a target error, a CAPTCHA, or an expired scrape deadline so the failure details reach the caller. The body has success: false, a stable code, a message, retryable, and credits.used: 0. If the target responded, metadata.statusCode records its HTTP status. A proxy authentication failure can use the same field to report the proxy’s HTTP 407.
| Code | Retryable | Next action |
|---|---|---|
SCRAPE_CHALLENGE_DETECTED | No | Skip this URL and continue with an accessible source. See the CAPTCHA response below. |
SCRAPE_ACCESS_DENIED | Varies | If retryable is false, skip the URL and use a different source. Retry only after the site's access requirements have been met. |
SCRAPE_RATE_LIMITED | Yes | The target rate-limited the request. Wait before retrying and reduce requests to that site. |
SCRAPE_PROXY_UNAVAILABLE | Yes | Berrycrawl returns HTTP 503 when its configured proxy route is unavailable or rejects proxy authentication. Back off and retry later. Give support the request ID if the failure persists. |
TARGET_DNS_UNRESOLVED | Varies | Read retryable on the HTTP 400 response. Correct an unknown hostname or retry a temporary DNS failure later. |
SCRAPE_CANCELLED | No | The client disconnected. Start another request only if the caller still needs the result. |
SCRAPE_FAILED | No | Read error and message. Give support the X-Request-ID if the cause is unclear. |
SCRAPE_CONTENT_UNAVAILABLE | No | Check for a corrected URL or use a different source. |
SCRAPE_TIMEOUT | Yes | Retry with backoff or use a larger allowed timeout. |
SCRAPE_UPSTREAM_ERROR | Yes | Retry with backoff or choose a different source. |
SCRAPE_EMPTY_CONTENT | Yes | Give the page more time to load or adjust the content selectors. Markdown containing only a same-page “Skip to content” link counts as empty main content. |
SCRAPE_DOCUMENT_TOO_LARGE | No | Use a smaller document or a public HTML version. |
SCRAPE_TARGET_REQUEST_REJECTED | No | Read the target HTTP status, check the URL and any site requirements, or choose another source. |
SCRAPE_TARGET_RESPONSE_ERROR | No | The browser could not read the target response. Use another source or send support the request ID. |
SCRAPE_NAVIGATION_INTERRUPTED | Yes | Navigation stopped or changed while Berrycrawl read the page. Retry later with backoff. |
SCRAPE_TLS_HANDSHAKE_FAILED | No | The site could not establish HTTPS. Use a different source or retry when the site restores compatible HTTPS. |
SCRAPE_CONNECTION_FAILED | Yes | The connection closed before the page arrived. Retry with backoff. |
SCRAPE_DOWNLOAD_NOT_PARSED | No | The page started a file download. Use the direct URL of a supported document or choose another source. |
SCRAPE_PARSER_LIMIT | No | The page exceeded a parser or rendered-page size limit. Use a smaller source. For a page with large inline images, request Markdown and enable removeBase64Images. |
SCRAPE_TLS_CERTIFICATE_INVALID | No | Use a different source or wait for the site to fix its HTTPS certificate. |
SCRAPE_PARSER_BUSY | Yes | Parser capacity is occupied. Retry later with backoff. |
SCRAPE_AUTHENTICATION_REQUIRED | No | The target requires authentication. A redirect from a content URL to a sign-in form uses zero credits. Use an accessible source. |
When the target replies with rate limiting or a temporary server error and asks the client to wait via Retry-After, Berrycrawl ends the attempt and includes retryAfterSeconds in the failure body. Wait at least that many seconds before trying the URL again. The failure uses zero credits.
Some sites redirect refused requests to an access-denied page that returns HTTP 404. Berrycrawl returns SCRAPE_ACCESS_DENIED with retryable: false when it recognizes that page. The original HTTP status stays in metadata.statusCode.
A parked domain, a hosting suspension notice, a removed hosted profile, or a response containing only a protection-provider footer returns SCRAPE_CONTENT_UNAVAILABLE and uses zero credits. Use another source for the requested page. An application error screen reported by the target returns SCRAPE_UPSTREAM_ERROR.
If a localized URL redirects to its site's country selector, Berrycrawl returns SCRAPE_CONTENT_UNAVAILABLE and uses zero credits. Try a corrected country-specific URL. If the site publishes the page in a different country edition, you can also request that edition with location.country and proxy: "auto".
When a fallback connection fails or times out, Berrycrawl reports the last classified target response it received. A CAPTCHA followed by a failed proxy tunnel returns SCRAPE_CHALLENGE_DETECTED with retryable: false. A failed tunnel without an earlier target verdict returns SCRAPE_PROXY_UNAVAILABLE. The API preserves a confirmed target failure when cleanup crosses the request deadline. Content that arrives after the deadline returns SCRAPE_TIMEOUT and uses zero credits.
CAPTCHA and anti-bot challenges
When the final scrape outcome is a CAPTCHA or anti-bot challenge, Berrycrawl returns HTTP 200 so the caller can read the result. The result has success: false, code: "SCRAPE_CHALLENGE_DETECTED", retryable: false, and credits.used: 0. The API omits data.
Have the agent skip further scrape or browser attempts for that URL and continue with another source. If the requested URL is the only suitable source, report that access was blocked.
metadata.statusCode is the status returned by the target site. A challenge page can arrive with an origin status such as 200, 403, 418, or 521. The response body reports SCRAPE_CHALLENGE_DETECTED when Berrycrawl recognizes the verification page. See the complete response fields in the Scrape API reference.
Retry policy
Respect retryable: false whenever Berrycrawl returns it. Use capped exponential backoff with jitter for transient failures. If the body includes retryAfterSeconds, use the larger of that value and your backoff delay. On a gateway response without a Berrycrawl code, use the HTTP status to decide whether the request is safe to retry. Common retry candidates are 429, 502, 503, and 504. Cap attempts and tell the caller why the request failed.
Log Berrycrawl's HTTP status, JSON code, and response X-Request-ID when available. If a gateway response has a CF-Ray header, include it with the timestamp when contacting support. Dashboard Usage lists credit changes.
Do not automatically resubmit a crawl or extract job if its creation response may have been delivered. First check your stored job identifier or idempotency boundary. Polling a known job is safer than creating a duplicate. When a job reports failed URLs in errors[], read their code, message, and retryable fields. Retry individual URLs marked retryable: true.
Synchronous scrape requests already wait in Berrycrawl's bounded FIFO admission queue when all active slots are occupied. Do not add a second aggressive retry loop around an in-flight request. For many unrelated URLs, use bounded parallel scrape requests and store each response independently.
Browser sessions
423 HUMAN_CONTROL_ACTIVE means a person holds control; wait for release. STALE_REF requires
a fresh snapshot. SESSION_CLOSED requires a new session. 402 INSUFFICIENT_CREDITS can end
an active session when its authorized budget is exhausted. 503 NO_BROWSER_CAPACITY means
capacity is busy. 503 START_FAILED means the session failed to launch. Honor Retry-After
before retrying either response. After a connection failure or gateway error without a Berrycrawl
code, list recent sessions before trying to create another. Use a unique metadata.request_id
at creation and filter the list with tag=request_id:<value>. Inspect the current session or
job state before repeating browser writes, hosted tasks, or recorded runs.