Chat with us, powered by LiveChat
← Return to MyDisct Solver

BBRE Error Codes

Every API integration eventually encounters errors, and the BBRE (Browser-Backed Request Engine) API is designed to give you precise, actionable error information when something goes wrong. Instead of returning generic HTTP status codes with vague messages, the BBRE API uses a structured error response format that includes a machine-readable error code, a human-readable message explaining what happened, and the appropriate HTTP status code that categorizes the type of failure. This page is a complete reference for every error code that the BBRE API can return, organized by category: authentication errors that indicate problems with your API key or account status, account errors related to billing and account state, request validation errors that flag malformed or invalid parameters, task errors for asynchronous request tracking issues, session errors covering the full range of session lifecycle problems, browser errors specific to adaptive mode browser automation, service errors indicating server-side issues, and rate limiting errors that protect the system from excessive usage. For each error code, you will find the exact error code string as it appears in the API response, the HTTP status code returned with that error, the default error message, a detailed explanation of what causes the error, and a concrete solution describing how to fix or handle it in your application. Beyond the error code reference tables, this page also covers the standard error response structure, practical error handling patterns in JavaScript, Python, and cURL, how the Node.js SDK surfaces errors through exceptions, which errors are safe to retry and which require code changes, and best practices for building resilient integrations that handle errors gracefully. Whether you are debugging a failing integration, building error handling logic for production, or trying to understand why a specific request failed, this page has the information you need to diagnose and resolve any BBRE API error.

Error Response Format

All BBRE API error responses follow a consistent JSON structure with success set to false, the service field identifying the BBRE engine, and an error object containing the code and message fields. Some errors may include an additional details field with more specific information about what went wrong. Your error handling code should always check the error.code field for programmatic error identification rather than parsing the message string, because messages may change between API versions while error codes remain stable.

Error Response Structure

When the BBRE API encounters an error during request processing, it returns a JSON response with a consistent structure that your application can parse programmatically. The response always includes the success field set to false, the service field set to "MyDisct Solver BBRE" to identify which service generated the error, and an error object containing the machine-readable code and the human-readable message. The HTTP status code of the response corresponds to the category of error: 400-level codes indicate client-side issues that you need to fix in your request, while 500-level codes indicate server-side issues that are typically transient and can be retried. Understanding this structure is the foundation for building robust error handling in your integration.

Standard Error Response

The following JSON structure is returned for every error response from the BBRE API. The error.code field is the primary identifier you should use in your error handling logic because it is stable across API versions and uniquely identifies the specific error condition. The error.message field provides a human-readable description suitable for logging or displaying to end users.

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message"
  }
}

Error Response with Details

Some error responses include an additional details field that provides more specific information about the error. This field is not present on all errors, so your parsing logic should treat it as optional. When present, the details field may contain information such as which specific parameter failed validation, what the accepted values are, or additional context about the server-side condition that caused the error.

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "INVALID_MODE",
    "message": "Invalid mode. Valid modes: passive, adaptive.",
    "details": "Received mode value: aggressive"
  }
}

Response Fields

Field Type Description
success boolean Always false for error responses. Check this field first to determine if the request succeeded or failed.
service string Always "MyDisct Solver BBRE". Identifies which service generated the response.
error.code string Machine-readable error code in UPPER_SNAKE_CASE format. Use this field for programmatic error handling and branching logic.
error.message string Human-readable error description. Suitable for logging and debugging. Do not parse this field programmatically because the message text may change.
error.details string Optional additional context about the error. Not present on all error responses. When available, provides specific information about what triggered the error.

Authentication Errors

Authentication errors occur when the BBRE API cannot verify your identity or when your credentials are missing, invalid, or associated with a problematic account state. Every request to the BBRE API requires a valid API key sent through the x-api-key or apikey HTTP header. If the API key is missing entirely, the API returns API_KEY_REQUIRED. If the key is present but does not match any active key in the system, the API returns INVALID_API_KEY. If the key is valid but there is a server-side issue during the validation process, the API returns API_KEY_VALIDATION_ERROR. Authentication errors are the most common errors encountered during initial integration because they surface immediately on the first request attempt. Once your API key is correctly configured, these errors should not appear in normal operation unless your key is rotated, revoked, or your account status changes.

Error Code HTTP Status Message Solution
API_KEY_REQUIRED 401 API Key is required. Please provide it in the header as x-api-key or apikey. Include your API key in the request headers. Use either the x-api-key header or the apikey header. The API does not accept API keys as query parameters or in the request body. Double-check that your HTTP client is actually sending the header and that it is not being stripped by a proxy or middleware.
INVALID_API_KEY 401 Invalid or inactive API Key. Please check your credentials. Verify that your API key is correct by checking it in your MyDisct Solver dashboard. Make sure you are using the BBRE API key and not a key from a different service. If you recently regenerated your key, update your application configuration with the new key. Keys that have been revoked or belong to deleted accounts will also trigger this error.
API_KEY_VALIDATION_ERROR 500 Error during API Key validation. Please try again later. This is a server-side error that occurs when the API key validation service is temporarily unavailable. Your API key may be perfectly valid, but the system could not verify it at this moment. Wait a few seconds and retry the request. If this error persists for more than a minute, check the MyDisct Solver status page or contact support.

Authentication Error Example

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "API_KEY_REQUIRED",
    "message": "API Key is required. Please provide it in the header as x-api-key or apikey."
  }
}

Account Errors

Account errors indicate that your API key is valid and was successfully verified, but your account is in a state that prevents the requested operation from being executed. These errors cover three distinct scenarios: your account has been suspended by an administrator (typically due to terms of service violations or suspicious activity), your account is inactive (it exists but has not been activated or has been deactivated), or your account does not have enough balance to cover the cost of the requested operation. Account errors require action on your part to resolve. Suspended and inactive accounts need to be addressed through the MyDisct Solver support team, while insufficient balance errors can be resolved by adding funds to your account through the dashboard. Unlike authentication errors which block all requests, account errors may be selective: for example, an account with insufficient balance can still make requests to free endpoints like /account/info and /account/balance, but will be blocked from creating requests or sessions that incur charges.

Error Code HTTP Status Message Solution
ACCOUNT_SUSPENDED 403 Your account has been suspended. Please contact support for more information. Your account has been suspended, which means all API operations are blocked until the suspension is lifted. Contact MyDisct Solver support to understand the reason for the suspension and the steps required to restore your account. Common reasons for suspension include terms of service violations, payment disputes, or unusual activity patterns detected by the automated monitoring system.
ACCOUNT_INACTIVE 403 Your account is inactive. Please activate your account or contact support. Your account exists in the system but is not in an active state. This can happen if your account was recently created but not yet activated, if it was deactivated due to prolonged inactivity, or if there is an administrative hold on the account. Log in to your MyDisct Solver dashboard to check your account status, or contact support if you believe this is an error.
INSUFFICIENT_BALANCE 402 Insufficient balance. Please add funds to your account. Your account balance is too low to cover the cost of the requested operation. The BBRE API charges per request based on the mode and sensibility level. Adaptive mode requests cost more than passive mode requests, and higher sensibility levels cost more than lower ones. Add funds to your account through the MyDisct Solver dashboard. You can check your current balance using the GET /account/balance endpoint before making requests to avoid this error.

Account Error Example

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "INSUFFICIENT_BALANCE",
    "message": "Insufficient balance. Please add funds to your account."
  }
}

Request Validation Errors

Request validation errors are returned when the BBRE API receives a request that contains invalid, malformed, or missing parameters. These errors are always HTTP 400 (Bad Request) responses, which means the problem is in your request and you need to fix it before retrying. The BBRE API validates request parameters before processing begins, so validation errors are returned immediately without consuming any account balance. This category covers a wide range of issues: missing required fields like the target URL, invalid values for enumerated parameters like mode and sensibility, malformed URL strings, invalid HTTP methods, out-of-range timeout values, and incorrectly structured proxy configurations. Each error code in this category tells you exactly which parameter failed validation and what the accepted values are, making it straightforward to identify and fix the issue. During development, you will likely encounter these errors frequently as you build and test your integration. In production, they should be rare if your request construction logic is correct, but you should still handle them gracefully because user input or dynamic data could introduce invalid values.

Error Code HTTP Status Message Solution
INVALID_REQUEST 400 Invalid request. Please check your request format. The request body could not be parsed or does not conform to the expected format. Make sure you are sending a valid JSON body with the Content-Type: application/json header. Check for syntax errors in your JSON payload such as trailing commas, unquoted keys, or mismatched brackets. If you are using a library to construct the request, verify that it is serializing the body correctly.
URL_REQUIRED 400 URL is required. Please provide the target URL for your request. The url parameter is missing from your request body. Every BBRE request that targets a web page must include the url field specifying the target URL. Add the url field to your JSON request body with the full URL including the protocol (http:// or https://).
INVALID_URL 400 Invalid URL format. URL must start with http:// or https:// The url parameter is present but does not have a valid format. The BBRE API requires URLs to start with either http:// or https://. URLs without a protocol prefix, URLs with other protocols (ftp://, file://), and malformed URL strings will trigger this error. Validate your URLs before sending them to the API.
INVALID_MODE 400 Invalid mode. Valid modes: passive, adaptive. The mode parameter contains a value that is not recognized by the BBRE API. The only accepted values are "passive" and "adaptive" (case-sensitive, lowercase). Passive mode handles simple HTTP requests without browser automation. Adaptive mode uses full browser automation for complex pages. Remove the mode parameter to use the default, or set it to one of the two accepted values.
INVALID_SENSIBILITY 400 Invalid sensibility. Valid values: low, medium, high. The sensibility parameter contains an unrecognized value. Accepted values are "low", "medium", and "high" (case-sensitive, lowercase). Low sensibility is fastest but least stealthy. Medium provides a balance between speed and stealth. High sensibility is slowest but applies the most sophisticated evasion techniques. Remove the parameter to use the default, or set it to one of the three accepted values.
INVALID_METHOD 400 Invalid HTTP method. Valid methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS. The method parameter specifies an HTTP method that the BBRE API does not support. The accepted methods are GET, POST, PUT, DELETE, PATCH, HEAD, and OPTIONS (case-insensitive). If you need to make a standard web request, GET is the default method and does not need to be specified explicitly. For form submissions and API calls through BBRE, use POST or the appropriate method for your target endpoint.
INVALID_TIMEOUT 400 Invalid timeout value. Timeout must be a number within the allowed range. The timeout parameter is not a valid number or falls outside the allowed range. The timeout value must be a positive number representing milliseconds. Extremely small values (less than 1000ms) may not give the BBRE engine enough time to process the request, while extremely large values may exceed the system maximum. Use a reasonable timeout value between 5000 and 120000 milliseconds (5 seconds to 2 minutes) for most use cases.
INVALID_PROXY 400 Invalid proxy configuration. Proxy must include host and port fields. The proxy parameter is present but does not have the required structure. A valid proxy configuration must be an object with at least host and port fields. The host should be a hostname or IP address, and the port should be a number. Optional fields include username and password for authenticated proxies, and protocol to specify the proxy protocol (http, https, socks5).

Request Validation Error Example

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "INVALID_MODE",
    "message": "Invalid mode. Valid modes: passive, adaptive."
  }
}

Task Errors

Task errors are specific to the asynchronous request workflow in the BBRE API. When you create a request using the POST /request/create endpoint, the API returns a taskId that you use to poll for results via POST /request/result. Task errors occur when there is a problem with this polling process: either you did not provide a task ID in your result request, or the task ID you provided does not correspond to any task in the system (or belongs to a different account). These errors are straightforward to diagnose and fix. The TASK_ID_REQUIRED error means you forgot to include the taskId parameter in your request body. The TASK_NOT_FOUND error means the task ID is present but does not match any existing task for your account. Task IDs are account-scoped, so you cannot access tasks created by other accounts even if you know their task IDs. Task IDs are also ephemeral and may be cleaned up after a period of time, so polling for very old task IDs may also return this error.

Error Code HTTP Status Message Solution
TASK_ID_REQUIRED 400 TaskId parameter is required. Include the taskId field in your request body when calling the /request/result endpoint. The task ID is returned in the response from /request/create when you create an asynchronous request. Store this value and pass it to the result endpoint to retrieve the completed response. If you are using the synchronous /request/execute endpoint instead, you do not need a task ID because the response is returned directly.
TASK_NOT_FOUND 404 Task not found or does not belong to this user. The task ID you provided does not match any task associated with your account. Verify that you are using the correct task ID from the /request/create response. Check that you are using the same API key that was used to create the task, because tasks are scoped to the account that created them. Also verify that the task ID has not been truncated or modified during storage or transmission. Very old tasks may have been cleaned up by the system, so if you are polling for a task that was created a long time ago, it may no longer exist.

Task Error Example

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "TASK_NOT_FOUND",
    "message": "Task not found or does not belong to this user."
  }
}

Session Errors

Session errors cover the full range of problems that can occur when working with BBRE sessions. Sessions are stateful browser contexts that maintain cookies, fingerprint profiles, and request history across multiple API calls. Because sessions have a lifecycle (created, active, expired, closed) and resource limits (maximum 10 active sessions per account), there are several error conditions specific to session management. The SESSION_NOT_FOUND error indicates that the session ID does not exist or belongs to a different account. SESSION_EXPIRED and SESSION_CLOSED indicate that the session existed but is no longer usable because it either timed out or was explicitly closed. SESSION_ID_REQUIRED means you forgot to include the session identifier in your request. SESSION_LIMIT_REACHED means you have hit the maximum number of concurrent active sessions and need to close one before creating a new one. Session errors are common in production applications that manage multiple concurrent sessions, and your error handling should account for all of these scenarios to build a resilient integration.

Error Code HTTP Status Message Solution
SESSION_NOT_FOUND 404 Session not found or does not belong to this user. The session ID you provided does not match any session associated with your account. Verify that you are using the correct session ID from the /session/create response. Check that you are using the same API key that was used to create the session. Session IDs are UUIDs, so make sure the full ID is being transmitted without truncation. If the session was created a long time ago, it may have been cleaned up by the system.
SESSION_EXPIRED 410 Session has expired. Please create a new session. The session you are trying to use has exceeded its timeout duration and is no longer active. Sessions have a limited lifetime and will expire if not used within the timeout period. Create a new session using POST /session/create and update your application to use the new session ID. To prevent session expiration, make requests within the session regularly or increase the timeout value when creating the session. Consider implementing session renewal logic that detects this error and automatically creates a replacement session.
SESSION_CLOSED 410 Session is closed. Please create a new session. The session you are trying to use was explicitly closed via the POST /session/close endpoint and can no longer accept requests. Once a session is closed, it cannot be reopened. Create a new session if you need to continue making requests. If your application has multiple components that share a session, make sure one component is not closing the session while another is still using it. Implement session state tracking to avoid using closed sessions.
SESSION_ID_REQUIRED 400 Session ID is required. Session ID is returned when you create a session. Include the sessionId field in your request body when making session-related API calls. The session ID is returned in the response from POST /session/create when you create a new session. Store this value and include it in all subsequent requests that operate within that session, including /session/request, /session/status, /session/close, and /browser/action.
SESSION_LIMIT_REACHED 429 Maximum active sessions limit reached. Please close an existing session before creating a new one. Your account has reached the maximum of 10 concurrent active sessions. You must close at least one existing session using POST /session/close before you can create a new one. Use POST /account/sessions with {"status": "active"} to list your active sessions and identify which ones can be closed. Implement session pooling in your application to reuse sessions instead of creating new ones for every operation. Consider closing sessions as soon as they are no longer needed rather than letting them expire naturally.

Session Error Example

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "SESSION_EXPIRED",
    "message": "Session has expired. Please create a new session."
  }
}

Browser Errors

Browser errors are specific to the adaptive mode browser automation features of the BBRE API. When you use the POST /browser/action endpoint to perform browser actions like navigating to pages, clicking elements, filling forms, or taking screenshots, the BBRE engine controls a real browser instance on the server side. Browser errors occur when the requested action cannot be completed: either because the action specification is missing or invalid, or because the browser encountered a problem while executing the action (element not found, page load timeout, JavaScript execution error, etc.). The ACTION_REQUIRED error is a validation error that means you did not specify what action to perform. The BROWSER_ACTION_FAILED error is a runtime error that means the browser attempted the action but it failed during execution. Browser action failures can be caused by many factors including incorrect CSS selectors, elements that are not visible or not interactable, pages that have not finished loading, or JavaScript errors on the target page.

Error Code HTTP Status Message Solution
ACTION_REQUIRED 400 Browser action is required. Please specify the action to perform. Include the action field in your request body when calling the /browser/action endpoint. The action field specifies what the browser should do: "navigate", "click", "fill", "type", "select", "screenshot", "execute", "wait", "scroll", "getCookies", and others. Each action type requires specific additional parameters. Refer to the Browser Action documentation for the complete list of supported actions and their parameters.
BROWSER_ACTION_FAILED 500 Browser action failed. Please try again. The browser attempted to execute the requested action but encountered an error during execution. This can happen for many reasons: the target element was not found on the page (check your CSS selector), the element exists but is not visible or interactable (it may be hidden, covered by another element, or outside the viewport), the page has not finished loading (add a wait action before interacting with elements), or the JavaScript code passed to the execute action threw an error. Check the error.details field if present for more specific information about what went wrong. Try adding explicit wait actions before interactions, verify your selectors using browser developer tools, and ensure the page is in the expected state before performing actions.

Browser Error Example

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "BROWSER_ACTION_FAILED",
    "message": "Browser action failed. Please try again."
  }
}

Service Errors

Service errors indicate problems on the BBRE server side that are not caused by your request. These errors cover general server failures, temporary service unavailability, request timeouts, pricing configuration issues, and processor availability problems. Most service errors are transient and can be resolved by retrying the request after a short delay. The SERVICE_ERROR code is a catch-all for unexpected server failures. SERVICE_UNAVAILABLE indicates that the BBRE service is temporarily down for maintenance or experiencing high load. SERVICE_TIMEOUT means your request took longer than the maximum allowed processing time. PRICING_NOT_CONFIGURED is a rare configuration error that should be reported to support. NO_PROCESSOR_AVAILABLE means all BBRE processing nodes are busy and cannot accept new requests at this moment. When you encounter service errors, implement exponential backoff retry logic: wait 1 second before the first retry, 2 seconds before the second, 4 seconds before the third, and so on up to a maximum of 5 retries. If the error persists after all retries, log the error details and alert your monitoring system.

Error Code HTTP Status Message Solution
SERVICE_ERROR 500 An error occurred on MyDisct Solver BBRE servers. Please try again. An unexpected error occurred on the server while processing your request. This is a general server error that can be caused by various internal conditions. Retry the request after a short delay (1-2 seconds). If the error persists across multiple retries, the issue may be systemic. Check the MyDisct Solver status page for any ongoing incidents, and contact support if the problem continues for more than a few minutes.
SERVICE_UNAVAILABLE 503 MyDisct Solver BBRE service is temporarily unavailable. Please try again in a few moments. The BBRE service is temporarily unable to process requests. This typically happens during planned maintenance windows, during deployment of new versions, or when the service is experiencing unusually high load. Wait 5-10 seconds and retry the request. The service should recover automatically. If the error persists for more than a few minutes, check the MyDisct Solver status page for maintenance announcements or incident reports.
SERVICE_TIMEOUT 504 Request timeout. Please try again. Your request exceeded the maximum processing time allowed by the BBRE engine. This can happen when the target website is very slow to respond, when the page requires extensive JavaScript execution in adaptive mode, or when the BBRE processing pipeline is under heavy load. Try the request again with a simpler configuration: use passive mode instead of adaptive if possible, reduce the sensibility level to low for faster processing, or target a more responsive URL. If you consistently hit timeouts on a specific URL, the target site may be blocking or throttling the requests.
PRICING_NOT_CONFIGURED 500 Service pricing is not configured. Please contact support. The pricing configuration for the requested operation is missing from the system. This is a server-side configuration error that you cannot fix on your end. Contact MyDisct Solver support and provide the details of your request (endpoint, mode, sensibility) so they can investigate and fix the pricing configuration. This error is rare and typically only occurs when new features are being rolled out.
NO_PROCESSOR_AVAILABLE 503 No processor available to handle your request. Please try again later. All BBRE processing nodes are currently busy handling other requests and cannot accept your request at this time. This is a capacity-related error that occurs during peak usage periods. Retry the request after a short delay (2-5 seconds). The system automatically scales to handle demand, so processors should become available shortly. If you consistently encounter this error, consider spreading your requests over a longer time period or contacting support to discuss capacity options for your use case.

Service Error Example

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "SERVICE_UNAVAILABLE",
    "message": "MyDisct Solver BBRE service is temporarily unavailable. Please try again in a few moments."
  }
}

Rate Limiting

The BBRE API enforces rate limits to protect the service from excessive usage and ensure fair access for all users. When you exceed the allowed request rate, the API returns a RATE_LIMIT_EXCEEDED error with HTTP status 429. Rate limits are applied per API key and are calculated over a sliding time window. The exact rate limits depend on your account tier and may vary between endpoints. When you receive a rate limit error, you should stop sending requests immediately and wait before retrying. Implementing proper rate limit handling is essential for production applications because aggressive retry behavior when rate limited can extend the duration of the rate limit window and delay your recovery. The best approach is to implement a backoff strategy that progressively increases the wait time between retries when rate limited.

Error Code HTTP Status Message Solution
RATE_LIMIT_EXCEEDED 429 Too many requests. Please wait a moment before trying again. You have exceeded the allowed request rate for your account. Stop sending requests and wait before retrying. Start with a 2-second delay and double it on each subsequent rate limit error (exponential backoff). Do not retry immediately because this will extend the rate limit window. If you consistently hit rate limits, reduce the frequency of your requests by implementing request queuing, batching operations where possible, or spreading requests over a longer time period. Contact support if you need higher rate limits for your use case.

Rate Limit Error Example

JSON
{
  "success": false,
  "service": "MyDisct Solver BBRE",
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Please wait a moment before trying again."
  }
}

Error Handling in Code

Proper error handling is the difference between a fragile integration that breaks at the first unexpected response and a production-ready system that gracefully handles every failure scenario. The BBRE API returns structured error responses that make it straightforward to implement comprehensive error handling in any programming language. The key principle is to always check the success field first, then branch on the error.code field to determine the appropriate action for each error type. The following examples demonstrate robust error handling patterns in JavaScript, Python, and cURL that you can adapt to your specific application architecture.

JavaScript Error Handling

In JavaScript, wrap your BBRE API calls in try-catch blocks and inspect the response body to determine the error type. The following example shows a complete error handling pattern that covers authentication errors, account errors, validation errors, session errors, rate limiting, and service errors with appropriate retry logic for transient failures.

JavaScript
const fetch = require("node-fetch");

const API_KEY = "your-api-key-here";
const BASE_URL = "https://bbre-solver-api.mydisct.com";

async function makeRequest(url, options) {
    const maxRetries = 3;
    let attempt = 0;

    while (attempt < maxRetries) {
        const response = await fetch(url, options);
        const data = await response.json();

        if (data.success) {
            return data;
        }

        const errorCode = data.error.code;

        if (errorCode === "API_KEY_REQUIRED" || errorCode === "INVALID_API_KEY") {
            throw new Error("Authentication failed: " + data.error.message);
        }

        if (errorCode === "ACCOUNT_SUSPENDED" || errorCode === "ACCOUNT_INACTIVE") {
            throw new Error("Account issue: " + data.error.message);
        }

        if (errorCode === "INSUFFICIENT_BALANCE") {
            throw new Error("No balance: " + data.error.message);
        }

        if (errorCode === "INVALID_REQUEST" || errorCode === "URL_REQUIRED" ||
            errorCode === "INVALID_URL" || errorCode === "INVALID_MODE" ||
            errorCode === "INVALID_SENSIBILITY" || errorCode === "INVALID_METHOD") {
            throw new Error("Validation error: " + data.error.message);
        }

        if (errorCode === "SESSION_EXPIRED" || errorCode === "SESSION_CLOSED") {
            throw new Error("Session ended: " + data.error.message);
        }

        if (errorCode === "SESSION_LIMIT_REACHED") {
            throw new Error("Too many sessions: " + data.error.message);
        }

        if (errorCode === "RATE_LIMIT_EXCEEDED") {
            const delay = Math.pow(2, attempt) * 2000;
            await new Promise(resolve => setTimeout(resolve, delay));
            attempt++;
            continue;
        }

        if (errorCode === "SERVICE_ERROR" || errorCode === "SERVICE_UNAVAILABLE" ||
            errorCode === "SERVICE_TIMEOUT" || errorCode === "NO_PROCESSOR_AVAILABLE") {
            const delay = Math.pow(2, attempt) * 1000;
            await new Promise(resolve => setTimeout(resolve, delay));
            attempt++;
            continue;
        }

        throw new Error("Unknown error: " + data.error.code + " - " + data.error.message);
    }

    throw new Error("Max retries exceeded");
}

async function createBBRERequest() {
    const result = await makeRequest(BASE_URL + "/request/execute", {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
            "x-api-key": API_KEY
        },
        body: JSON.stringify({
            url: "https://example.com",
            mode: "passive",
            sensibility: "medium"
        })
    });

    console.log("Status:", result.solution.status);
    console.log("Body length:", result.solution.body.length);
}

createBBRERequest().catch(console.error);

Python Error Handling

In Python, use the requests library to make API calls and inspect the JSON response body for error information. The following example demonstrates a retry-capable request function that handles all BBRE error categories with appropriate backoff for transient errors and immediate failure for permanent errors.

Python
import requests
import time

API_KEY = "your-api-key-here"
BASE_URL = "https://bbre-solver-api.mydisct.com"

PERMANENT_ERRORS = [
    "API_KEY_REQUIRED",
    "INVALID_API_KEY",
    "ACCOUNT_SUSPENDED",
    "ACCOUNT_INACTIVE",
    "INSUFFICIENT_BALANCE",
    "INVALID_REQUEST",
    "URL_REQUIRED",
    "INVALID_URL",
    "INVALID_MODE",
    "INVALID_SENSIBILITY",
    "INVALID_METHOD",
    "INVALID_TIMEOUT",
    "INVALID_PROXY",
    "TASK_ID_REQUIRED",
    "SESSION_ID_REQUIRED",
    "ACTION_REQUIRED",
    "SESSION_EXPIRED",
    "SESSION_CLOSED",
]

RETRYABLE_ERRORS = [
    "SERVICE_ERROR",
    "SERVICE_UNAVAILABLE",
    "SERVICE_TIMEOUT",
    "NO_PROCESSOR_AVAILABLE",
    "RATE_LIMIT_EXCEEDED",
    "API_KEY_VALIDATION_ERROR",
    "BROWSER_ACTION_FAILED",
]

def make_bbre_request(endpoint, payload):
    max_retries = 3
    attempt = 0

    while attempt < max_retries:
        response = requests.post(
            f"{BASE_URL}{endpoint}",
            json=payload,
            headers={
                "Content-Type": "application/json",
                "x-api-key": API_KEY
            }
        )

        data = response.json()

        if data.get("success"):
            return data

        error_code = data["error"]["code"]
        error_message = data["error"]["message"]

        if error_code in PERMANENT_ERRORS:
            raise Exception(f"Permanent error [{error_code}]: {error_message}")

        if error_code in RETRYABLE_ERRORS:
            delay = (2 ** attempt) * 1.5
            print(f"Retryable error [{error_code}], waiting {delay}s...")
            time.sleep(delay)
            attempt += 1
            continue

        raise Exception(f"Unexpected error [{error_code}]: {error_message}")

    raise Exception("Max retries exceeded")

result = make_bbre_request("/request/execute", {
    "url": "https://example.com",
    "mode": "passive",
    "sensibility": "medium"
})

print(f"Status: {result['solution']['status']}")
print(f"Body length: {len(result['solution']['body'])}")

cURL Error Handling

When using cURL from the command line or shell scripts, you can check the HTTP status code to determine if the request succeeded and parse the JSON response body to extract error details. The following example shows how to make a BBRE API request with cURL and handle the response in a bash script.

bash
curl -s -w "\n%{http_code}" \
  -X POST "https://bbre-solver-api.mydisct.com/request/execute" \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key-here" \
  -d '{
    "url": "https://example.com",
    "mode": "passive",
    "sensibility": "medium"
  }'

The -w "\n%{http_code}" flag appends the HTTP status code to the output, making it easy to check the response status. A status code of 200 indicates success. Status codes in the 400 range indicate client errors that need to be fixed in your request. Status codes in the 500 range indicate server errors that may be retried. Parse the JSON response body to extract the error.code and error.message fields for detailed error information.

bash
RESPONSE=$(curl -s -w "\n%{http_code}" \
  -X POST "https://bbre-solver-api.mydisct.com/request/execute" \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key-here" \
  -d '{"url": "https://example.com", "mode": "passive"}')

HTTP_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | sed '$d')

if [ "$HTTP_CODE" -eq 200 ]; then
  echo "Success"
  echo "$BODY" | python3 -m json.tool
elif [ "$HTTP_CODE" -eq 401 ]; then
  echo "Authentication error - check your API key"
elif [ "$HTTP_CODE" -eq 402 ]; then
  echo "Insufficient balance - add funds to your account"
elif [ "$HTTP_CODE" -eq 429 ]; then
  echo "Rate limited - wait before retrying"
  sleep 5
else
  echo "Error (HTTP $HTTP_CODE):"
  echo "$BODY" | python3 -m json.tool
fi

SDK Error Handling

The mydisctsolver-bbre Node.js SDK wraps the raw HTTP API and surfaces errors as JavaScript exceptions. When an API call fails, the SDK throws an error object that contains the same code and message fields from the API response, making it easy to handle errors using standard try-catch patterns. The SDK does not perform automatic retries for any error type, giving you full control over retry logic and error recovery strategies. Both the BBREClient and BBRESession classes throw errors in the same format, so your error handling code works consistently regardless of which class you are using. The BrowserAPI class, accessed through a session, also throws errors in the same format when browser actions fail.

BBREClient Error Handling

The BBREClient class throws errors for all API operations including requests, account queries, and session management. The error object includes the code property with the BBRE error code and the message property with the human-readable description.

JavaScript
const { BBREClient } = require("mydisctsolver-bbre");

const client = new BBREClient({ apiKey: "your-api-key-here" });

async function fetchPage() {
    try {
        const result = await client.request({
            url: "https://example.com",
            mode: "passive"
        });
        console.log("Page fetched, status:", result.solution.status);
    } catch (error) {
        if (error.code === "INSUFFICIENT_BALANCE") {
            console.log("Add funds to your account before making requests");
            return;
        }

        if (error.code === "INVALID_URL") {
            console.log("The URL format is invalid:", error.message);
            return;
        }

        if (error.code === "SERVICE_UNAVAILABLE" || error.code === "SERVICE_TIMEOUT") {
            console.log("Service temporarily unavailable, retrying in 3 seconds...");
            await new Promise(resolve => setTimeout(resolve, 3000));
            return fetchPage();
        }

        console.log("Unexpected error:", error.code, error.message);
    }
}

fetchPage();

BBRESession Error Handling

The BBRESession class adds session-specific errors on top of the standard BBRE errors. When working with sessions, you need to handle session lifecycle errors (SESSION_EXPIRED, SESSION_CLOSED) in addition to the standard request errors. A common pattern is to catch session expiration errors and automatically create a new session to continue the workflow.

JavaScript
const { BBRESession } = require("mydisctsolver-bbre");

async function sessionWorkflow() {
    let session = new BBRESession({
        apiKey: "your-api-key-here",
        mode: "adaptive",
        sensibility: "medium"
    });

    try {
        await session.start();
        console.log("Session started:", session.sessionId);

        const result = await session.request({ url: "https://example.com" });
        console.log("Page loaded, status:", result.solution.status);

        await session.browser.click({ selector: "button.submit" });
        console.log("Button clicked");

    } catch (error) {
        if (error.code === "SESSION_EXPIRED") {
            console.log("Session expired, creating new session...");
            session = new BBRESession({
                apiKey: "your-api-key-here",
                mode: "adaptive",
                sensibility: "medium"
            });
            await session.start();
            return;
        }

        if (error.code === "SESSION_LIMIT_REACHED") {
            console.log("Too many active sessions, close unused sessions first");
            return;
        }

        if (error.code === "BROWSER_ACTION_FAILED") {
            console.log("Browser action failed:", error.message);
            return;
        }

        console.log("Error:", error.code, error.message);
    } finally {
        try {
            await session.close();
        } catch (closeError) {
            console.log("Failed to close session:", closeError.message);
        }
    }
}

sessionWorkflow();

Error Object Structure

When the SDK throws an error, the error object has the following properties that you can use in your catch blocks for programmatic error handling.

Property Type Description
code string The BBRE error code in UPPER_SNAKE_CASE format. Same as the error.code field in the raw API response.
message string Human-readable error description. Same as the error.message field in the raw API response.
status number The HTTP status code from the API response (401, 402, 403, 400, 404, 410, 429, 500, 503, 504).

Retry Strategy

Not all BBRE API errors should be retried. Some errors indicate permanent problems that require code changes or account actions to resolve, while others indicate transient conditions that will resolve on their own after a short wait. Retrying permanent errors wastes time and API calls, while failing to retry transient errors causes unnecessary failures in your application. The following classification helps you build an intelligent retry strategy that maximizes reliability without wasting resources.

Retryable Errors (Transient)

These errors indicate temporary conditions that are likely to resolve on their own. Implement exponential backoff when retrying: start with a 1-2 second delay and double it on each retry, up to a maximum of 5 retries. If the error persists after all retries, treat it as a permanent failure and escalate to your error reporting system.

Error Code HTTP Status Recommended Retry Delay Max Retries
SERVICE_ERROR 500 1s, 2s, 4s (exponential) 3
SERVICE_UNAVAILABLE 503 5s, 10s, 20s (exponential) 3
SERVICE_TIMEOUT 504 2s, 4s, 8s (exponential) 3
NO_PROCESSOR_AVAILABLE 503 3s, 6s, 12s (exponential) 5
RATE_LIMIT_EXCEEDED 429 2s, 4s, 8s (exponential) 5
API_KEY_VALIDATION_ERROR 500 1s, 2s, 4s (exponential) 3
BROWSER_ACTION_FAILED 500 1s, 2s (exponential) 2

Non-Retryable Errors (Permanent)

These errors indicate problems that will not resolve by retrying the same request. They require changes to your request parameters, account configuration, or application logic. Retrying these errors will produce the same result every time and should be avoided.

Error Code HTTP Status Required Action
API_KEY_REQUIRED 401 Add the API key to your request headers
INVALID_API_KEY 401 Fix or replace your API key
ACCOUNT_SUSPENDED 403 Contact support to resolve account suspension
ACCOUNT_INACTIVE 403 Activate your account through the dashboard
INSUFFICIENT_BALANCE 402 Add funds to your account
INVALID_REQUEST 400 Fix the request body format
URL_REQUIRED 400 Add the url parameter to your request
INVALID_URL 400 Fix the URL format (must start with http:// or https://)
INVALID_MODE 400 Use "passive" or "adaptive" as the mode value
INVALID_SENSIBILITY 400 Use "low", "medium", or "high" as the sensibility value
INVALID_METHOD 400 Use a valid HTTP method (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
INVALID_TIMEOUT 400 Set timeout to a valid number within the allowed range
INVALID_PROXY 400 Fix the proxy object to include host and port fields
TASK_ID_REQUIRED 400 Include the taskId parameter in your request
TASK_NOT_FOUND 404 Verify the task ID and API key match
SESSION_NOT_FOUND 404 Verify the session ID and API key match
SESSION_EXPIRED 410 Create a new session to replace the expired one
SESSION_CLOSED 410 Create a new session to replace the closed one
SESSION_ID_REQUIRED 400 Include the sessionId parameter in your request
SESSION_LIMIT_REACHED 429 Close an existing session before creating a new one
ACTION_REQUIRED 400 Include the action parameter in your browser action request
PRICING_NOT_CONFIGURED 500 Contact support to report the pricing configuration issue

Exponential Backoff Implementation

The following JavaScript function implements exponential backoff with jitter, which is the recommended retry strategy for transient BBRE API errors. Jitter adds a small random component to the delay to prevent multiple clients from retrying at exactly the same time, which could cause a thundering herd effect on the server.

JavaScript
function calculateBackoff(attempt, baseDelay, maxDelay) {
    const exponentialDelay = baseDelay * Math.pow(2, attempt);
    const jitter = Math.random() * baseDelay;
    return Math.min(exponentialDelay + jitter, maxDelay);
}

async function retryableRequest(requestFn, maxRetries, baseDelay, maxDelay) {
    let lastError;

    for (let attempt = 0; attempt <= maxRetries; attempt++) {
        try {
            return await requestFn();
        } catch (error) {
            lastError = error;

            const retryableCodes = [
                "SERVICE_ERROR",
                "SERVICE_UNAVAILABLE",
                "SERVICE_TIMEOUT",
                "NO_PROCESSOR_AVAILABLE",
                "RATE_LIMIT_EXCEEDED",
                "API_KEY_VALIDATION_ERROR"
            ];

            if (!retryableCodes.includes(error.code)) {
                throw error;
            }

            if (attempt < maxRetries) {
                const delay = calculateBackoff(attempt, baseDelay, maxDelay);
                await new Promise(resolve => setTimeout(resolve, delay));
            }
        }
    }

    throw lastError;
}

Complete Error Code Reference

The following table provides a consolidated view of every error code that the BBRE API can return, sorted by HTTP status code. Use this table as a quick reference when you encounter an error and need to understand what it means and how to handle it. Each row includes the error code, HTTP status, category, and the default message returned by the API.

Error Code HTTP Category Message
INVALID_REQUEST 400 Validation Invalid request. Please check your request format.
URL_REQUIRED 400 Validation URL is required. Please provide the target URL for your request.
INVALID_URL 400 Validation Invalid URL format. URL must start with http:// or https://
INVALID_MODE 400 Validation Invalid mode. Valid modes: passive, adaptive.
INVALID_SENSIBILITY 400 Validation Invalid sensibility. Valid values: low, medium, high.
INVALID_METHOD 400 Validation Invalid HTTP method. Valid methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS.
INVALID_TIMEOUT 400 Validation Invalid timeout value. Timeout must be a number within the allowed range.
INVALID_PROXY
TASK_ID_REQUIRED 400 Task TaskId parameter is required.
SESSION_ID_REQUIRED 400 Session Session ID is required. Session ID is returned when you create a session.
ACTION_REQUIRED 400 Browser Browser action is required. Please specify the action to perform.
API_KEY_REQUIRED 401 Authentication API Key is required. Please provide it in the header as x-api-key or apikey.
INVALID_API_KEY 401 Authentication Invalid or inactive API Key. Please check your credentials.
INSUFFICIENT_BALANCE 402 Account Insufficient balance. Please add funds to your account.
ACCOUNT_SUSPENDED 403 Account Your account has been suspended. Please contact support for more information.
ACCOUNT_INACTIVE 403 Account Your account is inactive. Please activate your account or contact support.
TASK_NOT_FOUND 404 Task Task not found or does not belong to this user.
SESSION_NOT_FOUND 404 Session Session not found or does not belong to this user.
SESSION_EXPIRED 410 Session Session has expired. Please create a new session.
SESSION_CLOSED 410 Session Session is closed. Please create a new session.
RATE_LIMIT_EXCEEDED 429 Rate Limiting Too many requests. Please wait a moment before trying again.
SESSION_LIMIT_REACHED 429 Session Maximum active sessions limit reached. Please close an existing session before creating a new one.
SERVICE_ERROR 500 Service An error occurred on MyDisct Solver BBRE servers. Please try again.
API_KEY_VALIDATION_ERROR 500 Authentication Error during API Key validation. Please try again later.
BROWSER_ACTION_FAILED 500 Browser Browser action failed. Please try again.
PRICING_NOT_CONFIGURED 500 Service Service pricing is not configured. Please contact support.
SERVICE_UNAVAILABLE 503 Service MyDisct Solver BBRE service is temporarily unavailable. Please try again in a few moments.
NO_PROCESSOR_AVAILABLE 503 Service No processor available to handle your request. Please try again later.
SERVICE_TIMEOUT 504 Service Request timeout. Please try again.

Error Handling Patterns

Beyond basic try-catch error handling, production applications benefit from structured error handling patterns that centralize error logic, provide consistent behavior across your codebase, and make it easy to add monitoring and alerting. The following patterns demonstrate advanced error handling approaches that work well with the BBRE API.

Error Classification Helper

Create a helper function that classifies BBRE errors into categories, making it easy to apply consistent handling logic throughout your application. This approach separates the error classification logic from the handling logic, keeping your code clean and maintainable.

JavaScript
function classifyBBREError(errorCode) {
    const classifications = {
        auth: ["API_KEY_REQUIRED", "INVALID_API_KEY", "API_KEY_VALIDATION_ERROR"],
        account: ["ACCOUNT_SUSPENDED", "ACCOUNT_INACTIVE", "INSUFFICIENT_BALANCE"],
        validation: [
            "INVALID_REQUEST", "URL_REQUIRED", "INVALID_URL", "INVALID_MODE",
            "INVALID_SENSIBILITY", "INVALID_METHOD", "INVALID_TIMEOUT",
            "INVALID_PROXY", "TASK_ID_REQUIRED", "SESSION_ID_REQUIRED",
            "ACTION_REQUIRED"
        ],
        session: [
            "SESSION_NOT_FOUND", "SESSION_EXPIRED", "SESSION_CLOSED",
            "SESSION_LIMIT_REACHED"
        ],
        task: ["TASK_NOT_FOUND"],
        browser: ["BROWSER_ACTION_FAILED"],
        service: [
            "SERVICE_ERROR", "SERVICE_UNAVAILABLE", "SERVICE_TIMEOUT",
            "PRICING_NOT_CONFIGURED", "NO_PROCESSOR_AVAILABLE"
        ],
        rateLimit: ["RATE_LIMIT_EXCEEDED"]
    };

    for (const [category, codes] of Object.entries(classifications)) {
        if (codes.includes(errorCode)) {
            return category;
        }
    }

    return "unknown";
}

async function handleBBRERequest(requestFn) {
    try {
        return await requestFn();
    } catch (error) {
        const category = classifyBBREError(error.code);

        if (category === "auth") {
            console.log("Authentication problem, check API key configuration");
        }

        if (category === "account") {
            console.log("Account issue, check dashboard for details");
        }

        if (category === "validation") {
            console.log("Request validation failed:", error.message);
        }

        if (category === "session") {
            console.log("Session problem:", error.code);
        }

        if (category === "service" || category === "rateLimit") {
            console.log("Transient error, safe to retry:", error.code);
        }

        throw error;
    }
}

Session Recovery Pattern

When working with BBRE sessions, implement automatic session recovery that detects expired or closed sessions and creates replacements transparently. This pattern is essential for long-running applications that maintain sessions over extended periods.

JavaScript
const { BBRESession } = require("mydisctsolver-bbre");

class ResilientSession {
    constructor(config) {
        this.config = config;
        this.session = null;
    }

    async ensureSession() {
        if (!this.session) {
            this.session = new BBRESession(this.config);
            await this.session.start();
        }
        return this.session;
    }

    async execute(operation) {
        try {
            const session = await this.ensureSession();
            return await operation(session);
        } catch (error) {
            if (error.code === "SESSION_EXPIRED" || error.code === "SESSION_CLOSED") {
                this.session = null;
                const session = await this.ensureSession();
                return await operation(session);
            }
            throw error;
        }
    }

    async close() {
        if (this.session) {
            try {
                await this.session.close();
            } catch (e) {
                console.log("Session close failed:", e.message);
            }
            this.session = null;
        }
    }
}

const resilient = new ResilientSession({
    apiKey: "your-api-key-here",
    mode: "adaptive",
    sensibility: "medium"
});

const result = await resilient.execute(async (session) => {
    return await session.request({ url: "https://example.com" });
});

await resilient.close();

Balance Check Before Requests

To avoid INSUFFICIENT_BALANCE errors in production, implement a pre-flight balance check that verifies your account has sufficient funds before making paid requests. This is especially useful for batch operations where you want to ensure all requests can be completed before starting the batch.

JavaScript
const { BBREClient } = require("mydisctsolver-bbre");

const client = new BBREClient({ apiKey: "your-api-key-here" });

async function checkBalanceAndExecute(urls) {
    const balanceData = await client.getBalance();
    const currentBalance = balanceData.balance;
    const estimatedCostPerRequest = 0.005;
    const totalEstimatedCost = urls.length * estimatedCostPerRequest;

    if (currentBalance < totalEstimatedCost) {
        console.log("Insufficient balance for batch operation");
        console.log("Current balance:", currentBalance);
        console.log("Estimated cost:", totalEstimatedCost);
        console.log("Deficit:", totalEstimatedCost - currentBalance);
        return;
    }

    const results = [];
    for (const url of urls) {
        const result = await client.request({ url, mode: "passive" });
        results.push(result);
    }

    return results;
}

checkBalanceAndExecute([
    "https://example.com/page1",
    "https://example.com/page2",
    "https://example.com/page3"
]);

Best Practices

Following these best practices will help you build a robust BBRE integration that handles errors gracefully, minimizes unnecessary failures, and provides a good experience for your end users.

  • Always check the success field first. Before accessing any data in the API response, verify that success is true. This is the most reliable way to determine if the request succeeded, regardless of the HTTP status code. Some HTTP libraries may not throw exceptions for 4xx/5xx responses, so relying solely on exception handling can miss errors.
  • Use error.code for programmatic error handling, not error.message. Error codes are stable identifiers that will not change between API versions. Error messages are human-readable descriptions that may be updated, rephrased, or translated in future versions. Build your branching logic around error codes and use messages only for logging and display purposes.
  • Implement exponential backoff with jitter for retryable errors. When retrying transient errors like SERVICE_UNAVAILABLE, SERVICE_TIMEOUT, NO_PROCESSOR_AVAILABLE, and RATE_LIMIT_EXCEEDED, use exponential backoff (doubling the delay on each retry) with a small random jitter component. This prevents multiple clients from retrying at the same time and overwhelming the server.
  • Classify errors into retryable and non-retryable categories. Not all errors should be retried. Authentication errors, validation errors, and account errors are permanent and will produce the same result on every retry. Service errors and rate limit errors are transient and should be retried with backoff. Implement this classification in a centralized error handler rather than duplicating the logic across your codebase.
  • Set a maximum retry count and total timeout. Even for retryable errors, limit the number of retries (3-5 is typical) and the total time spent retrying (30-60 seconds). If the error persists beyond these limits, escalate to your error reporting system rather than retrying indefinitely. Infinite retry loops can consume resources and mask systemic issues.
  • Check your balance before batch operations. If you are processing a large batch of URLs, check your account balance before starting the batch to ensure you have sufficient funds for all requests. This prevents partial batch completion where some requests succeed and others fail with INSUFFICIENT_BALANCE.
  • Implement session recovery for long-running workflows. Sessions can expire or be closed unexpectedly. Build session recovery logic that detects SESSION_EXPIRED and SESSION_CLOSED errors and automatically creates a replacement session to continue the workflow without losing progress.
  • Log error details for debugging. When an error occurs, log the full error response including the error code, message, HTTP status, and any details field. Also log the request that caused the error (excluding sensitive data like API keys) so you can reproduce and debug the issue later.
  • Validate inputs before sending requests. Many validation errors can be prevented by validating your inputs before sending them to the API. Check that URLs start with http:// or https://, that mode values are "passive" or "adaptive", that sensibility values are "low", "medium", or "high", and that timeout values are positive numbers. Client-side validation is faster and cheaper than server-side validation.
  • Monitor error rates in production. Track the frequency of each error code over time. A sudden increase in SERVICE_ERROR or SERVICE_UNAVAILABLE errors may indicate a systemic issue. A gradual increase in RATE_LIMIT_EXCEEDED errors may indicate that your application is growing beyond your current rate limits. Use this data to proactively address issues before they impact your users.

Common Issues

The following are the most frequently encountered issues when integrating with the BBRE API, along with their root causes and solutions. These issues are based on real support tickets and developer feedback.

API Key Not Being Sent in Headers

Symptom: Every request returns API_KEY_REQUIRED even though you have set the API key in your code.

Root Cause: The API key is being set as a query parameter, in the request body, or in a header with the wrong name. Some HTTP libraries have default behaviors that may strip custom headers or modify header names.

Solution: Verify that your HTTP client is sending the API key as an HTTP header with the exact name x-api-key or apikey. Use your browser's developer tools or a tool like Postman to inspect the actual headers being sent. If you are using a proxy or API gateway, check that it is not stripping custom headers from the request.

Session Expired During Long Workflow

Symptom: A multi-step workflow that uses sessions fails partway through with SESSION_EXPIRED.

Root Cause: Sessions have a limited lifetime. If there is a long delay between requests within a session (for example, waiting for user input or processing data between steps), the session may expire before the next request is made.

Solution: Implement session recovery logic that catches SESSION_EXPIRED errors and creates a new session to continue the workflow. If your workflow requires long pauses between steps, consider using the session status endpoint to check if the session is still active before making the next request. You can also increase the session timeout when creating the session, or make periodic keep-alive requests to prevent expiration.

Hitting the 10 Active Session Limit

Symptom: Creating a new session fails with SESSION_LIMIT_REACHED even though you thought all previous sessions were closed.

Root Cause: Sessions that are not explicitly closed remain active until they expire. If your application crashes or exits without closing its sessions, those sessions continue to count against your 10-session limit until they expire naturally.

Solution: Always close sessions in a finally block or cleanup handler to ensure they are closed even if your application encounters an error. Use the POST /account/sessions endpoint with {"status": "active"} to list your active sessions and identify any orphaned sessions that need to be closed. Implement a startup routine that checks for and closes any leftover sessions from previous runs.

BROWSER_ACTION_FAILED on Element Interaction

Symptom: Browser actions like click, fill, or type fail with BROWSER_ACTION_FAILED even though the selector appears correct.

Root Cause: The target element may not be visible, may be covered by another element (like a modal or overlay), may not have finished loading, or may be outside the current viewport. Dynamic pages that load content asynchronously are particularly prone to this issue.

Solution: Add explicit wait actions before interacting with elements. Use waitForElement or waitForSelector to ensure the element exists and is visible before clicking or filling it. If the element is below the fold, scroll to it first using the scroll action. For pages with overlays or modals, dismiss them before interacting with elements behind them. Use the screenshot action to capture the current page state for debugging.

Inconsistent INVALID_URL Errors

Symptom: Some URLs work fine while others that look similar return INVALID_URL.

Root Cause: The failing URLs may contain special characters that are not properly encoded, may be missing the protocol prefix, or may have invisible characters (like zero-width spaces or byte order marks) that were introduced during copy-paste operations.

Solution: Always encode URLs properly before sending them to the API. Use encodeURI() in JavaScript or urllib.parse.quote() in Python to handle special characters. Verify that the URL starts with http:// or https://. If you are reading URLs from a file or database, trim whitespace and check for invisible characters by logging the URL length and comparing it to the visible character count.