Main Error Type
BrewApiError represents a non-2xx HTTP response. Branch on code for a specific case or type for a category.
The Error Catalog owns codes and recovery guidance.
If
bodyError is set, the status is available but the error fields may be generic fallbacks.
Typical Catch Pattern
API Errors vs Transport Errors
Timeout and connection errors extend
BrewTransportError.
It exposes method, url, attempts, idempotencyKey, and inProgress.
Cancellation rejects with the signal’s own reason.
Timeouts and Cancellation
The default per-attempttimeoutMs is 30_000, with up to two retries for eligible transient failures.
PATCH requests are not retried. Image-upload steps have their own retry rules; see Upload a Local Image.
The timeout covers connecting, waiting for headers, and reading the body.
Long-running methods raise a shorter client timeout: emails.generate() uses 240 seconds and content.gif() uses 300 seconds.
A per-request timeoutMs overrides that default.
Set retryOnTimeout: false to stop after a timeout rather than retrying it.
Pass signal in the client config or request options to cancel, including during retry backoff.
Cancellation is never retried.
Replay an Unknown Outcome
A timeout, dropped connection, or cancellation may leave work running on the server. Keep the request inputs and retry key so you can recover the same intended action. The SDK generates a key for supportedPOST calls and keeps it across automatic retries.
API and transport errors expose it as idempotencyKey. For a write you may cancel, supply and retain your own key.
If inProgress is true, an automatic retry found the original request still running.
Wait, then replay with the same inputs and key.
Read Idempotency for replay guarantees and behavior when the deduplication store is unavailable.
For other writes that must never repeat during a storage outage, set maxRetries: 0.
Check whether the first request succeeded before retrying.
Log requestId when asking support to investigate an API or parse error.
Need Help?
Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:- Self-Service Tools
- Talk to Our Team
Search Documentation
Type in the “Ask any question” search bar at the top left to instantly find relevant documentation pages.
Ask ChatGPT or Claude
Click here to open the Copy page menu at the top of this page, then send the page to ChatGPT, Claude, or your editor.