Skip to Content
Browser API

Errors and close codes

Handshake errors returned before the WebSocket opens, and the WebSocket close codes used after it.

Errors come in two stages. A problem found during the handshake is an HTTP response and the WebSocket never opens. A problem during a running session closes the WebSocket with a close code.

Handshake errors

The response body is JSON: { "error", "code", "message" }. Branch on the HTTP status and code, not on message.

HTTP statuscodeMeaningWhat to do
400INVALID_CONNECTION_PARAMSA modifier is invalid, unknown, or repeated; the URL carries a query string; or type-custom has no proxy.Fix the URL. See Connection URL.
400INVALID_PROFILE_IDThe pid value is not a profile id issued by the server.Use an id from the dashboard.
401UNAUTHORIZEDWrong login or password. The two are intentionally not told apart. The response has WWW-Authenticate: Basic.Check the credentials in the URL.
402INSUFFICIENT_BALANCEThe balance is below the first billing portion. No browser was started.Top up, then retry. See Billing.
403ACCOUNT_SUSPENDEDThe browser account is suspended.Contact support.
409PROFILE_BUSYThe profile already has a live session.Wait for it to end, or use another profile.
409SESSION_IN_USEAnother client is connected to this session-<id>.Use a different session id, or disconnect the other client.
409PROFILE_LIMIT_REACHEDThe account has reached its profile limit.Delete unused profiles.
429CONCURRENCY_LIMITThe account has too many concurrent sessions.Wait for a session to end, then retry.
429RATE_LIMITEDToo many connection attempts, also after repeated wrong passwords.Back off, then retry.
503PROXY_UNREACHABLEThe customer proxy is unreachable or is not a public address.Check the proxy URL.
503GEO_PROBE_FAILEDThe exit location could not be verified. No session is started and nothing is billed.Retry; try another country or type if it persists.
503NO_CAPACITYNo browser capacity right now. The response has Retry-After.Retry after the indicated delay.
503NO_ROUTEThere is no route for the requested class and country; the message names both.Choose another class or country.
503CLASS_UNAVAILABLEThe requested network class is not available right now.Choose another class.
503RATE_LIMIT_UNAVAILABLEConnection rate limiting is temporarily unavailable.Retry with backoff.

Retry only the statuses that can change on their own: 429 and 503 (except 503 PROXY_UNREACHABLE, which needs a working proxy). Honor Retry-After when present. Do not retry 400, 401, 403, or 409 without a change.

WebSocket close codes

After the WebSocket has opened, it can close with one of these codes.

CodeNameMeaning
1000NormalThe session ended normally.
1008Policy violationA frame was not valid CDP, a message was larger than 8 MB, or the session exceeded the traffic ceiling.
1011Internal errorAn internal error occurred, or the browser closed.
1013Try again laterBackpressure: the connection could not keep up. Slow down and retry.
4402INSUFFICIENT_BALANCEThe balance ran out during the session.
4410Session endedThe session was ended by the platform. The close reason names why: MAX_DURATION, IDLE_TIMEOUT, KILLED, ACCOUNT_SUSPENDED, DELETED, WORKER_SHUTDOWN, BROWSER_CRASHED, and others.
4412WORKER_LOSTThe machine that held the browser disappeared.

After 4410 or 4412, connect again to start a new browser.

CDP errors

A blocked CDP command is not a close: the socket stays open and the command answers an error with code -32000 and a message starting with POLICY_BLOCKED:. See Blocking policy.

Last updated on

On this page