Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

API Error Responses: HTTP Status, Error Codes, and Fields

How Brave, Cloudflare, and other APIs structure error payloads, what status codes mean, and how to fix common failure modes.

When an HTTP API call fails, the response body usually carries more detail than the status line alone. This page concentrates on documented error shapes from the Brave Search API reference (which repeats across many Brave endpoints) and Cloudflare APIs, with shorter notes on Chrome FedCM, Perplexity safety blocks, and validation-oriented errors.

HTTP status codes: what fails before you read the body

Section titled “HTTP status codes: what fails before you read the body”

HTTP status tells you the class of failure: client mistake (4xx), success with caveats, or server-side problems (5xx). Several providers in this cluster document the same client statuses for search and AI endpoints.

Status Typical meaning in these docs Often paired with
400 Malformed or unacceptable request Validation or bad parameters
402 Payment or billing required Quota or subscription (Brave)
403 Forbidden: auth OK but action not allowed Plan, safety, or entitlement
404 Resource or route not found Wrong ID or URL
422 Semantically invalid input Schema or parameter rules
429 Rate or usage limit exceeded Retry after backoff

Brave documents 400, 402, 403, 404, 422, and 429 on endpoints such as Answers, Web Search, and LLM Context. The field layouts for those responses are the same across those references.

For Cloudflare AI Gateway, exceeding allowed throughput yields a classic rate-limit response:

When your requests exceed the allowed rate, you will encounter rate limiting. This means the server will respond with a 429 Too Many Requests status code and your request will not be processed.

— Cloudflare, Rate limiting

Logpush datasets can record whether a gateway request was throttled: the AI Gateway Events dataset includes a RateLimited boolean described as “Request rate limited.”

Brave’s API references describe a consistent JSON error model. Top-level fields include optional type, an error object, and optional time.

Across Answers, Image search, Place search, and related pages, the error object carries:

Field Role
error.id Unique identifier for this occurrence
error.status HTTP status for this problem (documented as int; described as applicable status code)
error.detail Human-oriented explanation, possibly localized
error.meta Optional non-standard metadata
error.code Application-specific string code (see below)

Allowed values for error.code are the same on the documented Brave endpoints:

INTERNAL, QUOTA_LIMITED, RATE_LIMITED, SUBSCRIPTION_TOKEN_INVALID, SUBSCRIPTION_NOT_FOUND, RESOURCE_NOT_ALLOWED, OPTION_NOT_IN_PLAN, USAGE_LIMIT_EXCEEDED, INVALID_URL, CREDIT_EXHAUSTED.

Treat error.code as the stable handle for automation; use error.detail for operators and support. Map 429 responses to RATE_LIMITED or QUOTA_LIMITED rather than assuming every throttle is identical—check error.code and error.detail.

Endpoint-specific pages (News search GET, Video search POST, Spell check, etc.) mainly differ by path and parameters; error semantics are shared. Once you understand one reference section (for example Rich search), the others describe the same error envelope.

Cloudflare: RFC 9457, v4 envelope, and product codes

Section titled “Cloudflare: RFC 9457, v4 envelope, and product codes”

Cloudflare uses more than one error style depending on the product.

Error responses in Cloudflare fundamentals list standard members:

Field Type Description
type string URI pointing to Cloudflare documentation for this error code
title string Short summary
status integer HTTP status code of the response
detail string Plain-text explanation of what went wrong and which party is responsible
instance string Ray ID identifying this specific error occurrence

The instance field (Ray ID) is especially useful when opening a support case or correlating edge logs.

Cloudflare’s Artifacts REST API documents application errors in the v4 envelope:

export interface ApiError {
code: number;
message: string;
documentation_url?: string;
source?: {
pointer?: string;
};
}

Numeric code plus message and optional source.pointer (JSON Pointer to the offending field) differ from Brave’s string error.code—clients integrating multiple Cloudflare products should not assume one parser fits all responses.

Custom Providers returns explicit examples:

  • 409 / duplicate slug — code 1003, message that a custom provider slug already exists; slugs must be unique per account.
  • 404 — code 1004, custom provider not found or inaccessible; verify ID and credentials.
  • 400 / invalid base_url — code 1002; base_url must be HTTPS; HTTP is rejected for security.

These illustrate Cloudflare’s pattern: HTTP status, numeric code, message, and sometimes path into the request body.

Spectrum error codes tie failures to account tier. For example, code 10012 (“Unknown field in request JSON”) appears for Pay-as-you-go accounts when the body contains unrecognized fields; Enterprise apps may ignore unknown fields instead. Pay-as-you-go create/update is limited to protocol, dns, and origin_direct unless Spectrum is enabled as a paid add-on.

Other Spectrum examples: 11014 (FTP not enabled, HTTP 403), 11026 (Argo Smart Routing requested but not enabled), 11045 (invalid virtual_network_id UUID—resolve IDs from the list virtual networks API).

Validation and schema errors: locating the first failure

Section titled “Validation and schema errors: locating the first failure”

WAF profile fields define sampled violation structure for the first detected failure:

Field Meaning
location Request component: path, query, header, cookie, or body
error_class Stable category (e.g. constraint_violation, missing_required)
error_detail Optional specific reason (e.g. number_not_in_range)
target Optional parameter, header, cookie, or JSON path (e.g. $.items[0].quantity)

Analyze profile detections notes that error_detail or target may be empty when other fields suffice—for example a missing body may use missing_required without a target.

error_class values documented on Fields include invalid_type, invalid_syntax, constraint_violation, body_size, and others; error_detail can narrow further (invalid_json, number_not_in_range, pattern_no_match, format violations like format_violation:uuid, etc.).

Schema validation explains OneOf failures: the body must match exactly one subschema. Matches zero often means a discriminator is set but required fields for that type are missing. Matches multiple means ambiguous payloads (e.g. fields that fit two branches). Fix by aligning the live request with the uploaded OpenAPI profile.

SQL API errors states that the introspection endpoint shares status codes with query execution, but 422 on introspection relates to introspection parameters, not SQL syntax—do not reuse SQL troubleshooting steps blindly.

Other documented error patterns in this cluster

Section titled “Other documented error patterns in this cluster”

The FedCM identity provider guide describes an optional error object from id_assertion_endpoint with code (OAuth 2.0 names or arbitrary string) and optional same-site url for a human-readable help page. Without url, Chrome omits a “More details” control; without a typed error, the UI stays generic.

Chrome extensions: declarativeNetRequest regex failures

Section titled “Chrome extensions: declarativeNetRequest regex failures”

declarativeNetRequest documents regex rule validation enums: syntaxError (invalid or non-RE2 features) and memoryLimitExceeded. These are rule-definition errors, not HTTP API bodies.

Blocked users return HTTP 403 with type safety_identifier_blocked and a message that the identifier is blocked for the API organization.

Cloudflare Browser Rendering: success with null result

Section titled “Cloudflare Browser Rendering: success with null result”

The accessibility tree endpoint can return HTTP 200 with success: true and accessibilityTree: null when the root selector matches no element—distinct from a transport error; clients must not treat 200 alone as “tree captured.”

RealtimeKit error 0504: “Message not found by the given ID”—verify the message exists before querying.

Stream webhooks use errReasonCode values such as ERR_MALFORMED_VIDEO, ERR_DURATION_TOO_SHORT, and ERR_UNKNOWN when state is error; playback still requires readyToStream true.

  • Ignoring the body on 4xx/5xx — Brave and Cloudflare both put actionable codes in JSON; logging only the status wastes error.id or Ray ID.
  • Treating all 429 as retryable — Back off for AI Gateway rate limiting, but also check Brave USAGE_LIMIT_EXCEEDED or CREDIT_EXHAUSTED where retry without billing change will not help.
  • Mixing Cloudflare envelopes — Problem Details fields, v4 errors[], and Spectrum numeric codes need different parsers.
  • Assuming WAF samples list every violation — Profile analysis reports the first detected failure only; fix iteratively.
  • Expecting errors when selectors miss — Browser Run may return 200 with a null tree; that is an empty match, not an API fault.
  1. Reproduce the failing call with the same method, URL, headers, and body your application uses; save the full response status and JSON body (see any Brave endpoint reference such as Web Search POST for the expected error shape).

  2. Compare the HTTP status to the provider’s table for that product (Answers for Brave AI, Cloudflare error responses for edge HTTP errors, Custom Providers for gateway configuration).

  3. If the payload includes an application code, map it: Brave error.code from the allowed enum; Cloudflare numeric code and message; WAF samples via Fields when debugging API Shield.

  4. For throttling, confirm whether the event was rate-limited in AI Gateway Events or matches RATE_LIMITED / 429 in Brave docs, then adjust concurrency or quotas before retrying.

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page does not match the official documentation, or you need a clarification on a specific provider error, write to yimasynthetic@gmail.com with the page URL and the exact statement or error payload you are asking about.