Skip to Content
searchSDK

Error codes reference

Every searchSDK SearchError code: what it means, whether it is retried, falls back or may be billed, and what to do.

Every failure throws SearchError with one fixed code. Messages are fixed per code and never include keys or response bodies. Retries need maxRetries; fallback needs fallback.

Codes

CodeHTTP statusRetriedFalls backMeaning and what to do
invalid_request–nonoFix the input: field names the option or query. Nothing was sent.
configuration–nonoFix the client: a missing or unusable key (field: "keys"), no or an unknown provider, or a bad setting.
unsupported–noyesThe provider cannot express this request (field says which option). A fallback skips it; otherwise drop the option or pick another provider.
auth401nonoThe provider rejected the key. Check the key variable.
forbidden403nonoThe key is valid but not allowed this call (plan or permission).
quota402noyesOut of credits or over a plan limit. Top up, or fall back.
rate_limit429yesyesToo many requests. Set maxRetries to honour Retry-After, or fall back.
unavailable408, other 500–599yesyesA 5xx or 408. Retry, or fall back.
provider_errorother 400–499nonoAny other 4xx: the provider refused the request as sent. providerCode and the attempt status help.
network–yesyesNo answer: the connection failed or broke off. It may have been billed.
attempt_timeout–yesyesOne attempt passed attemptTimeoutMs. Retried and falls back.
timeout–nonoThe whole call passed timeoutMs. Raise it or lower retries.
aborted–nonoYour signal aborted the call.
invalid_response–nonoA 2xx that is not a UTF-8 JSON object, or a status searchSDK cannot map (3xx). Billed for a 2xx, never retried.
spec_mismatch–nonoA 2xx JSON object without the list the spec reads; path names it and raw keeps the body. Our spec and the provider disagree: report it.
response_too_large–nonoA 2xx over maxResponseBytes. Raise the limit or ask for fewer items.

An attempt that got a 2xx is billed, so it is never retried; one that got an error status is not billed. With no status, network, attempt_timeout, timeout and aborted attempts are billed possible, and the rest were never sent. An empty result list is a success, never an error.

Provider status rules

Some providers signal a code with their own status or body. These rules run before the shared status table.

ProviderStatusWhenCode
Brave Search429error.code = "QUOTA_LIMITED"quota
Perplexity401error.type = "insufficient_quota"quota
Tavily432–quota
Tavily433–quota
Tavily434–unavailable
TinyFish429error.details.reason = "free_allowance_exhausted"quota

SearchError fields

FieldTypeMeaning
codeErrorCodeOne of the codes above.
provider?AnyProviderIdThe provider of the failing attempt.
status?numberHTTP status, when one arrived.
providerCode?stringThe provider's own machine-readable code, when its spec says where to read it.
retryAfterMs?numberThe provider's Retry-After, in milliseconds.
field?stringThe option that failed validation or that the provider cannot honour.
path?stringFor spec_mismatch: the spec path the body did not have.
attemptsAttempt<AnyProviderId>[]Every attempt made before the failure, with its cost and billing.
raw?unknownThe parsed body of a 2xx that could not be mapped.

message is the fixed text for the code. Guides: Errors and troubleshooting.

On this page