Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Documents how Supabase Studio displays API and SQL errors, classifies them, and wires troubleshooting steps and the AI debug button.
27% 95%+68 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 6 of 22 without it.
This test ran on v2. v5 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Not used yet
Full architecture, SQLSTATE predicates, and mapping walkthrough: apps/studio/components/interfaces/ErrorHandling/README.md
handleError() → throws tagged StudioError → React Query catches → ErrorMatcher / AlertError renders UI
handleError (@/data/fetchers) throws Effect Data.TaggedError instances (_tag, fault: user | platform | third_party | studio, reason, classifiedBy: rule | default, retryable, service, plus legacy message, code, requestId, …). Check with isStudioError(e) from @/lib/errors/studio-errors, never instanceof; StudioError is a union type only.data/error-classification.ts): classifyResponseError({ message, code }) is for HTTP API responses only (ERROR_PATTERNS win, else 5xx PlatformError, 4xx UnclassifiedApiError, no status UnexpectedError — never pass a made-up status). classifyError(e) handles everything else (tagged passes through, AbortError → RequestAborted, browser fetch failure → NetworkUnreachable, else UnexpectedError). Successful JSON GETs still empty after recovery reject from the fetch layer as MalformedResponseError (normalizeEmptyBodyResponse) without hitting handleError (reportQueryError still reports it).executeSql runs pg-meta errors through classifySqlResponseError: user/AI SQL becomes UserSqlError (never sent to Sentry); Studio SQL becomes StudioSqlError (redacted message, static queryName required; marked fault: 'user', reason: 'user_input' when isUserFaultSqlState accepts the SQLSTATE via composable isUserFaultForValues (typed values: filters, row edits) or isUserFaultForSql (embedded SQL: policies, functions) in data/error-classification.ts).UserSqlError never sent, StudioSqlError redacted), while ERROR_ROUTING (lib/errors/error-routing.ts) maps every tag + fault to { sentrySampleRate } (SAMPLE_NEVER / SAMPLE_USER_FAULT / SAMPLE_OTHER / SAMPLE_OWNED / SAMPLE_ALWAYS, looked up via getErrorRouting). reportStudioError tags sample_rate (enforced in beforeSend) and sets errorEventId.QueryCache/MutationCache onError (reportQueryError) reports once after the final retry using sentryContext and alwaysCapture remembered by handleError. Pass reportImmediately: true to handleError only for callers outside React Query.| File | Purpose |
|---|---|
apps/studio/data/error-patterns.ts | ERROR_PATTERN_MAP (Map<ErrorConstructor, RegExp>) — regex lives here, never in UI components |
apps/studio/lib/errors/studio-errors.ts | Tagged error classes, StudioError union type, isStudioError |
apps/studio/data/error-classification.ts | classifyResponseError, classifyError, classifySqlResponseError, predicates |
apps/studio/lib/errors/error-routing.ts | ERROR_ROUTING table per tag and fault, getErrorRouting |
apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.tsx | Looks up error class in error-mappings.tsx and renders troubleshooting UI |
apps/studio/components/interfaces/ErrorHandling/error-mappings.tsx | Map<ErrorConstructor, ErrorMapping> ({ id, Troubleshooting }) |
apps/studio/components/interfaces/ErrorHandling/errorMappings/ConnectionTimeout.tsx | Reference troubleshooting component (including AI Assistant debug button wiring) |
apps/studio/components/interfaces/ErrorHandling/TroubleshootingSections.tsx | Reusable accordion section components |
apps/studio/components/interfaces/ErrorHandling/TroubleshootingAccordion.tsx | Accordion wrapper with telemetry |
| Situation | Use |
|---|---|
| Query failed and page/section cannot render its data (default across Studio) | AlertError from @/components/ui/AlertError |
| Error may be a classified class with troubleshooting steps (e.g. timeout) | ErrorMatcher from @/components/interfaces/ErrorHandling/ErrorMatcher — pass fallback for unclassified errors |
| Mutation failed | The mutation hook's default onError toast (toast.error from sonner) — don't render an alert (see studio-queries) |
AlertError (default)Next to this one in the catalogue, plus more from the same author.