error.code (stable), not on error.message (human-readable, can change).
The Error Envelope
details Shape: PUBLISH_VALIDATION_FAILED (409)
When PATCH /v1/automations/{automationId} with { published: true } is blocked, details.blockers[] enumerates every node-level reason so callers can render a fix-it list.
details Shape: AUTOMATION_GRAPH_INVALID (400)
When POST /v1/automations (or PATCH with new nodes/connections) fails the server-side FK + structural resolver, details.issues[] enumerates every problem. Each carries a kind you can branch on:
Foundational Error Codes (Every Endpoint)
These can appear on any v1 endpoint:Resource-Specific Codes
Triggers (/v1/automations/triggers)
Automations (/v1/automations)
Automation Runs (/v1/automations/runs)
Emails (/v1/emails)
Sends (/v1/sends)
Domains Lifecycle (/v1/domains)
Audiences (/v1/audiences)
Contacts + Fields (/v1/contacts, /v1/fields)
SDK Error Handling (TypeScript)
The official@brew.new/sdk throws a typed BrewApiError on every non-2xx response, exposing the full envelope:
Branching Agent / SDK Logic on code
Three rules:
codeis stable. It’s part of our public contract. We will not change the spelling of a code; we may add new ones.typeis a coarse bucket for default UX. Usetype === 'rate_limit'to gate a retry; usetype === 'authentication_error'to ask the user to re-issue the key.- Never branch on
message. Operator-facing copy may change between releases.
See Also
- Rate limits:
429 RATE_LIMITED+Retry-Aftercookbook. - Idempotency:
409 IDEMPOTENCY_CONFLICTsemantics. - Authentication:
401/403codes. - TypeScript SDK error handling: patterns + retry helpers.
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.
ChatGPT/Claude Integration
Click “Open in ChatGPT” at the top right of any page to analyze documentation with ChatGPT or Claude for deeper insights.