Agent skill

Supabase Common Errors

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Diagnose and fix Supabase errors across PostgREST, PostgreSQL, Auth, Storage, and Realtime.

MITAuto-check passedDatabases

Install Supabase Common Errors

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill supabase-common-errors -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace supabase-common-errors --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/supabase-common-errors .claude/skills/supabase-common-errors && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
supabase-common-errors
GitHub stars
2.8k
Token cost
~2.1k tokens
SKILL.md length
823 words
Files
5 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Diagnose and fix Supabase errors across PostgREST, PostgreSQL, Auth, Storage, and Realtime.

  • Works in 3 steps: Capture the Error Object → Identify the Error Layer and Code → Apply the Fix and Verify
  • Encountering error codes like PGRST301
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 4 more sections
  • Calls supabase, npm and npx; needs SUPABASE_ANON_KEY and SUPABASE_SERVICE_ROLE_KEY

What it does

Supabase Common Errors is an agent skill from jeremylongshore/tons-of-skills-marketplace. Diagnose and fix Supabase errors across PostgREST, PostgreSQL, Auth, Storage, and Realtime. Use when encountering error codes like PGRST301, 42501, 23505, or auth failures. Use when debugging failed queries, RLS policy violations, or HTTP 4xx/5xx responses. Trigger with "supabase error", "fix supabase", "PGRST", "supabase 403", "RLS not working", "supabase auth error", "unique constraint", "foreign key violation".

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `references/error-reference.md`, `references/errors.md` and `references/examples.md`). Compatibility notes: Designed for Claude Code

It sits in Databases. It works with Supabase and PostgreSQL. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Encountering error codes like PGRST301
  • Debugging failed queries
  • RLS policy violations
  • HTTP 4xx/5xx responses

Example prompts

  • “supabase error”
  • “fix supabase”
  • “supabase 403”
  • “/supabase-common-errors”

Requirements

  • Node.js
  • A credential in SUPABASE_ANON_KEY
  • A credential in SUPABASE_SERVICE_ROLE_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Grep, Bash(curl:*), Bash(supabase:*), Bash(npx:*)

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Capture the Error Object
  2. Identify the Error Layer and Code
  3. Apply the Fix and Verify

What it can do on your machine

Read from SKILL.md and the folder at commit 80f86df. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep
    • Bash(curl:*)
    • Bash(supabase:*)
    • Bash(npx:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • supabase
    • npm
    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • supabase.com
    • postgrest.org
    • postgresql.org
    • status.supabase.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • SUPABASE_ANON_KEY
    • SUPABASE_SERVICE_ROLE_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Supabase Common Errors loads about 2.1k tokens when it runs, and up to ~5.9k if it reads all its reference files. Until then it costs about 110 tokens; SKILL.md has 823 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~110
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit 80f86df, republished under its MIT licence (© jeremylongshore). 823 words, ~2,129 tokens.

Download SKILL.mdSave it as .claude/skills/supabase-common-errors/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
supabase-common-errors
description
Diagnose and fix Supabase errors across PostgREST, PostgreSQL, Auth, Storage, and Realtime. Use when encountering error codes like PGRST301, 42501, 23505, or auth failures. Use when debugging failed queries, RLS policy violations, or HTTP 4xx/5xx responses. Trigger with "supabase error", "fix supabase", "PGRST", "supabase 403", "RLS not working", "supabase auth error", "unique constraint", "foreign key violation".
allowed-tools
Read, Grep, Bash(curl:*), Bash(supabase:*), Bash(npx:*)
compatibility
Designed for Claude Code
version
1.54.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, supabase, debugging, errors, postgrest, rls, auth

Supabase Common Errors

Overview

Diagnostic guide for Supabase errors across PostgREST (PGRST*), PostgreSQL (numeric codes), Auth, Storage, and Realtime. Identify the error layer, trace the root cause, and apply the correct fix — every SDK call returns { data, error } where data is null when error exists.

The workflow is three steps: capture the error object, classify it by layer and code, then apply and verify the fix. Full step-by-step code lives in the diagnostic walkthrough; complete lookup tables are in the error reference.

Prerequisites

  • @supabase/supabase-js installed (npm install @supabase/supabase-js)
  • SUPABASE_URL and SUPABASE_ANON_KEY (or SUPABASE_SERVICE_ROLE_KEY) configured
  • Access to Supabase Dashboard (for log inspection and SQL Editor)
  • Supabase CLI installed for local development (npx supabase --version)

Instructions

Step 1 — Capture the Error Object

Every Supabase SDK call returns a { data, error } tuple. Never assume data exists — always destructure and check error first, because data is null whenever error is set.

typescript
const { data, error } = await supabase.from('todos').select('*')
if (error) {
  console.error(`[${error.code}] ${error.message}`)
  return  // data is null here — do not touch it
}
console.log(`Found ${data.length} rows`)

If error is undefined rather than null, upgrade to @supabase/supabase-js@2.x. See the walkthrough for the full guard pattern.

Step 2 — Identify the Error Layer and Code

Match the code prefix to its subsystem, then look it up in the Error Handling tables below:

  • PGRST* → PostgREST (API gateway: JWT, query parsing, schema)
  • 5-digit numeric (e.g. 42501, 23505) → PostgreSQL engine (RLS, constraints, migrations)
  • AuthApiError → Auth service (credentials, confirmation, token expiry)
  • StorageApiError → Storage service (bucket, RLS on storage.objects, size limits)

A missing code usually means the HTTP status is the signal: 401 → bad/missing SUPABASE_ANON_KEY; 500 → an unhandled exception in a database function. A paste-ready diagnoseSupabaseError() classifier is in the walkthrough.

Step 3 — Apply the Fix and Verify

Apply the fix from the matching Error Handling table, then re-run the original operation to confirm. Common recoveries:

  • Refresh an expired JWT (PGRST301) with supabase.auth.refreshSession().
  • Confirm an RLS block (42501) by re-querying with the service-role client before correcting the policy.
  • After a migration, reload the PostgREST schema cache (Dashboard → Settings → API → "Reload schema cache", or NOTIFY pgrst, 'reload schema').

Full before/after fix code for both cases is in the walkthrough.

Output

Deliverables after applying this skill:

  • Error identified by code and layer (PostgREST, PostgreSQL, Auth, Storage, Realtime)
  • Root cause isolated using the diagnostic helper or manual code inspection
  • Fix applied from the Error Handling table and verified against the original failing operation
  • Guard code in place (if (error) checks) preventing silent null-data bugs

Error Handling

The two most-cited layers are inline below. Auth, Storage, and Realtime tables are in the full error reference.

PostgREST API Errors (PGRST*)
CodeHTTPMeaningRoot CauseFix
PGRST301401JWT expired or invalidSUPABASE_ANON_KEY is wrong, or the user session expiredVerify SUPABASE_ANON_KEY matches the project; call supabase.auth.refreshSession()
PGRST302401Missing Authorization headerClient created without a key, or middleware stripped the headerPass SUPABASE_ANON_KEY to createClient(); check proxy/CDN config
PGRST116406No rows returned for .single()Query matched 0 rows but .single() expects exactly 1Use .maybeSingle() for optional lookups, or check filters
PGRST200400Invalid query parametersMalformed filter, bad operator, or invalid column referenceCheck filter syntax: .eq('col', val) not .eq('col = val')
PGRST204400Column not foundColumn name doesn't exist in the table or viewVerify column exists with supabase gen types typescript; check for typos
PGRST000503Connection pool exhaustedToo many concurrent connections from serverless functionsEnable pgBouncer (Supavisor) in project settings; reduce connection count
Show full SKILL.md (275 more words)Show less
PostgreSQL Database Errors (5-digit codes)
CodeMeaningRoot CauseFix
42501RLS policy violationRow-level security is blocking the operation for this userAdd or fix the RLS policy; test with service role to confirm
23505Unique constraint violationINSERT/UPDATE conflicts with an existing rowUse .upsert({ onConflict: 'column' }) or check existence first
23503Foreign key violationReferenced row doesn't exist in the parent tableInsert the parent row first, or check the foreign key value
42P01Table or relation doesn't existMigration not applied, or wrong schemaRun supabase db push; verify schema with \dt in SQL Editor
42703Column doesn't existSchema out of sync with codeRegenerate types: supabase gen types typescript --local > types/supabase.ts
57014Query cancelled (statement timeout)Query took longer than statement_timeoutAdd indexes; simplify the query; increase timeout in postgresql.conf

Examples

The most common failure — calling .single() on optional data — is inline below. Three more worked examples (upsert to dodge 23505, Realtime subscription error handling, and serverless pool exhaustion) are in the examples reference.

Handling .single() on optional data (PGRST116)
typescript
// BAD — throws PGRST116 when the user has no profile row
const { data: profile } = await supabase
  .from('profiles').select('*').eq('user_id', userId).single()

// GOOD — returns null instead of erroring
const { data: profile, error } = await supabase
  .from('profiles').select('*').eq('user_id', userId).maybeSingle()

if (!profile) {
  await supabase.from('profiles').insert({ user_id: userId, display_name: 'New User' })
}

Resources

Next Steps

  • Use supabase-debug-bundle to generate a full diagnostic snapshot when errors persist after applying these fixes.
  • Use supabase-security-basics to audit your RLS policies and prevent 42501 errors proactively.
  • Use supabase-known-pitfalls for edge cases and SDK behavior that can cause subtle bugs.
  • Use supabase-observability to set up logging and alerting so you catch errors before users report them.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (references) in skills/.curated/supabase-common-errors of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/error-reference.md
  • references/errors.md
  • references/examples.md
  • references/implementation.md

Open the folder on GitHubat commit 80f86df

Compare with similar skills

Supabase Common Errors next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Supabase Common Errors compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Supabase Common Errors this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2.1kAutomated safety check: PassMIT
Srtd Devt1mmen/srtd105—~2.3kAutomated safety check: PassMIT
Supabase Postgres Best Practicessupabase/agent-skills2.7k24 repos~808Automated safety check: PassMIT
Clickhouse Logs Queriessupabase/supabase111k—~2.4kAutomated safety check: PassApache-2.0
Safe SQL Executionsupabase/supabase111k—~4.2kAutomated safety check: PassApache-2.0
Add Backendahpxex/open-dashboard146—~3.6kAutomated safety check: PassMIT

Similar skills

  • Srtd Dev

    t1mmen/srtd

    Expert knowledge for developing the SRTD codebase itself. An agent skill from t1mmen/srtd.

    105 GitHub stars~2.3k tokensUpdated 1 mo ago
    DatabasesAuto-check passed
  • Official

    Gives the agent Postgres rules to consult before writing or changing tables, queries, indexes, RLS policies or migrations, and when diagnosing slow queries.

    2.7k GitHub starsUsed in 24 repos~808 tokens
    DatabasesAuto-check passed
  • Clickhouse Logs Queries

    supabase/supabase

    Official

    Write, review, and migrate Supabase logs queries against the ClickHouse-backed logs table (the logs.all.otel analytics endpoint).

    111k GitHub stars~2.4k tokensUpdated today
    DatabasesAuto-check passed
  • Safe SQL Execution

    supabase/supabase

    Official

    A skill your agent uses whenever code will build, return, fetch, or execute SQL that runs against a user's real Postgres database — even when the request reads like an ordinary feature or bug fix…

    111k GitHub stars~4.2k tokensUpdated today
    DatabasesAuto-check passed
  • Add Backend

    ahpxex/open-dashboard

    Everything about the data layer — pick one of six ready-to-run backend templates (TanStack Start + Drizzle + better-auth, Hono + Drizzle + better-auth, Hono + Prisma + better-auth, Hono + Drizzle +…

    146 GitHub stars~3.6k tokensUpdated 3 mo ago
    DatabasesAuto-check passed
  • Take Doc Screenshots

    pgplex/pgconsole

    Take screenshots of the running pgconsole app for documentation.

    155 GitHub stars~841 tokensUpdated 1 mo ago
    DatabasesAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Supabase Common Errors

What does Supabase Common Errors do?

Diagnose and fix Supabase errors across PostgREST, PostgreSQL, Auth, Storage, and Realtime. Supabase Common Errors is an agent skill from jeremylongshore/tons-of-skills-marketplace. Diagnose and fix Supabase errors across PostgREST, PostgreSQL, Auth, Storage, and Realtime.

When should I use Supabase Common Errors?

Supabase Common Errors fits situations like: encountering error codes like PGRST301; debugging failed queries; RLS policy violations; HTTP 4xx/5xx responses.

How do I install Supabase Common Errors in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill supabase-common-errors -a claude-code`. Or copy the skill folder (skills/.curated/supabase-common-errors in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/supabase-common-errors in your project. Claude Code loads it when a task matches its description.

How do I install Supabase Common Errors in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill supabase-common-errors -a codex`. Or copy the skill folder (skills/.curated/supabase-common-errors in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/supabase-common-errors in your project. Codex loads it when a task matches its description.

Can I use Supabase Common Errors in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill supabase-common-errors -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/supabase-common-errors, .gemini/skills/supabase-common-errors, .github/skills/supabase-common-errors and .opencode/skills/supabase-common-errors in your project.

What does Supabase Common Errors need to run?

Going by SKILL.md and its folder, Supabase Common Errors needs the command-line tools its instructions call (supabase, npm and npx) and credentials named SUPABASE_ANON_KEY and SUPABASE_SERVICE_ROLE_KEY. Our summary lists: Node.js; A credential in SUPABASE_ANON_KEY; A credential in SUPABASE_SERVICE_ROLE_KEY. Its frontmatter pre-approves these tools: Read, Grep, Bash(curl:*), Bash(supabase:*), Bash(npx:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Supabase Common Errors access the network?

SKILL.md names 4 domains. As links in the text: supabase.com, postgrest.org, postgresql.org and status.supabase.com. This is read from the text; nothing was executed.

Is Supabase Common Errors safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Supabase Common Errors use?

Supabase Common Errors is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Supabase Common Errors use?

About 2.1k tokens (SKILL.md is roughly 8.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.8k tokens, read only when the agent opens those files.

What are the alternatives to Supabase Common Errors?

Skills that share tags, products or a category with Supabase Common Errors: Srtd Dev (t1mmen/srtd, 105 stars), Supabase Postgres Best Practices (supabase/agent-skills, 2.7k stars), Clickhouse Logs Queries (supabase/supabase, 111k stars) and Safe SQL Execution (supabase/supabase, 111k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Supabase Common Errors?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,825 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 9, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.