Cloud Browser API Errors

The Cloud Browser API returns standard HTTP status codes and detailed error information to help you troubleshoot issues. This page lists error codes specific to browser session operations.

Browser-Specific Errors

The Cloud Browser API has specific error codes that are unique to browser session operations:

Error Handling Best Practices

Understanding how to handle browser errors is crucial for building robust automation scripts. Different error types require different handling strategies.

Retryable Errors - Automatic Recovery

Some browser errors are transient and can be safely retried. These typically indicate temporary resource unavailability or network issues.

Retryable error codes:

Recommended retry strategy:

Non-Retryable Errors - Immediate Action Required

These errors indicate configuration issues, quota limits, or session timeouts that cannot be automatically resolved. You must take action before retrying.

Non-retryable error codes:

How to handle non-retryable errors:

  1. Config errors: Review the error message and fix invalid parameters
  2. Quota reached: Upgrade your plan or wait until quota resets (monthly)
  3. Session timeout: Design scripts to complete within session time limits
  4. Concurrency limit: Wait for existing sessions to close before starting new ones

Connection Lifecycle & Errors

Understanding when errors occur in the browser connection lifecycle helps with debugging and implementing proper error handling.

Connection Phases

  1. WebSocket Handshake

    Initial HTTP upgrade to WebSocket connection.

    Possible errors:

    • ERR::BROWSER::WEBSOCKET_UPGRADE_FAILED - Network issues, invalid headers
  2. Browser Allocation

    Request browser instance from the pool.

    Possible errors:

    • ERR::BROWSER::ALLOCATION_FAILED - Pool saturated, no available instances
    • ERR::BROWSER::TOO_MANY_CONCURRENT_REQUEST - Plan concurrency limit reached
    • ERR::BROWSER::QUOTA_LIMIT_REACHED - Monthly quota exhausted
    • ERR::BROWSER::PROXY_UNAVAILABLE - Requested proxy unavailable
  3. CDP Connection

    Establish Chrome DevTools Protocol connection to browser.

    Possible errors:

    • ERR::BROWSER::CDP_CONNECTION_FAILED - Browser crashed, network timeout
    • ERR::BROWSER::CONFIG_ERROR - Invalid CDP configuration
  4. Active Session

    Browser session is active and ready for automation commands.

    Possible errors:

    • ERR::BROWSER::SESSION_TIMEOUT - Session exceeded maximum duration

Monitoring Browser Sessions

Track your browser usage to avoid hitting limits and optimize your automation workflows.

Monitoring recommendations:

  • Active sessions: Check GET /account endpoint for current concurrent session count
  • Monthly quota: Monitor remaining browser hours via dashboard or API
  • Session duration: Log session start/end times to optimize scripts
  • Error rates: Track error codes to identify patterns (e.g., frequent allocation failures)

Troubleshooting Common Issues

Cause: Browser pool is temporarily saturated (high demand).

Solutions:

  • Implement exponential backoff retry logic (wait 1s, 2s, 4s, 8s)
  • Reduce concurrent session usage during peak hours
  • Upgrade to a plan with dedicated browser instances
  • Contact support if issue persists for extended periods

Cause: You've reached your plan's concurrent browser session limit.

Solutions:

  • Close unused browser sessions before starting new ones
  • Implement session pooling to reuse browsers across tasks
  • Queue automation tasks to run sequentially instead of in parallel
  • Upgrade to a plan with higher concurrency limits

Cause: Network issues or firewall blocking WebSocket connections.

Solutions:

  • Verify your network allows WebSocket connections (not just HTTP/HTTPS)
  • Check firewall rules for port 443 (wss://) or port 80 (ws://)
  • Ensure no proxy/middleware is stripping WebSocket upgrade headers
  • Test with a simple WebSocket client to isolate the issue

Cause: Browser session exceeded maximum allowed duration.

Solutions:

  • Optimize scripts to complete tasks faster (e.g., reduce wait times)
  • Split long-running tasks into multiple shorter sessions
  • Use caching to avoid re-scraping already processed data
  • Consider using the Crawler API for large-scale, long-running jobs

Note: Session timeout errors are billed as the session was active until timeout.

HTTP Status Codes

Status Code Description
101 Switching Protocols WebSocket connection successfully upgraded
400 Bad Request Invalid parameters or configuration (ERR::BROWSER::CONFIG_ERROR)
401 Unauthorized Invalid or missing API key
408 Request Timeout Browser session timeout (ERR::BROWSER::SESSION_TIMEOUT)
422 Unprocessable Entity Proxy unavailable (ERR::BROWSER::PROXY_UNAVAILABLE)
429 Too Many Requests Quota or concurrency limit exceeded
502 Bad Gateway CDP connection failed (ERR::BROWSER::CDP_CONNECTION_FAILED)
503 Service Unavailable Browser allocation failed (ERR::BROWSER::ALLOCATION_FAILED)

Error Response Format

Browser API errors are returned via WebSocket messages in a consistent format:

Error message fields:

  • type - Always "error" for error messages
  • error.code - Machine-readable error code (e.g., ERR::BROWSER::ALLOCATION_FAILED)
  • error.message - Human-readable error description
  • error.retryable - Whether the operation can be retried
  • error.http_code - HTTP status code equivalent
  • error.details - Additional context-specific details (optional)

Summary