Skip to content
>_VibeUnstuck

relation "public.profiles" does not exist

Last verified:

The fix

relation "public.profiles" does not exist (42P01): that table is missing here. PGRST205 means the schema cache lacks it. Run the migration on this project.

  1. 1

    See if this database has the table

    Open the SQL Editor and run the lookup below with the table name from the error. Supabase's 42P01 note uses information_schema.tables and ILIKE so a case difference still shows up. The Table Editor is the visual view of the same database. An empty result means the migration did not run on this project. A row in another table_schema means the API's default schema (public) is not where the table is.

    select table_schema, table_name
    from information_schema.tables
    where table_name ilike 'profiles';
  2. 2

    Run the migration on this project

    Paste the CREATE TABLE into the SQL Editor, or apply the local migration files with the CLI. supabase db push requires the directory to be linked (supabase link --project-ref <id>). It applies migrations that are not yet in supabase_migrations.schema_migrations and skips the ones already recorded. supabase db push --dry-run prints that list and does not apply it. Pushing to a different project ref, or to a branch, creates the table somewhere the app is not calling.

  3. 3

    Point the app at the project you just migrated

    The client URL has to be this project's URL from Settings, then API. A second Supabase project, a preview branch, or an old NEXT_PUBLIC_ / VITE_ value still calls the database where the table was never created. Rebuild after you change the URL. If createClient throws supabaseUrl is required, the URL never made it into the bundle.

  4. 4

    Reload the schema cache, then add RLS

    If the table is in public and the API still returns PGRST205, run the notify below in the SQL Editor. The reload note says the result is Success. No rows returned. For a table in another schema, call .schema('that_schema') and expose that schema under Settings, then API, then Exposed schemas. Creating a table in the SQL Editor does not add policies. Enable RLS and add a policy. Do not disable RLS to make the 404 go away. A 404 means the API cannot see the table. A policy error is a later response.

    NOTIFY pgrst, 'reload schema';

Why it happens

PostgreSQL's error-code appendix names SQLSTATE 42P01 as undefined_table. The message is relation "..." does not exist. The table was never created in this database, the name or schema is wrong, or a quoted identifier made the name case-sensitive. Supabase's 42P01 note says to look the name up in information_schema.tables, and to call a non-public schema explicitly.

PostgREST's error reference names PGRST205 as HTTP 404, "Caused when the table specified in the URI is not found." With verbose errors the body is Could not find the table 'public.itemsxx' in the schema cache. That cache is stale when the table exists and the API has not reloaded. Supabase's schema-reload note says to run NOTIFY pgrst, 'reload schema'; in the SQL Editor. A permission error (42501, permission denied for table) and an RLS error (new row violates row-level security policy) both require the table to exist. They are the next pages, not this one.

The next error you'll probably hit

Once this is fixed, the usual follow-up is new row violates row-level security policy. new row violates row-level security policy: RLS is on and no INSERT policy allows this role. Add a policy for the signed-in user. A missing GRANT differs.

Prompt to paste back into your AI tool

Paste this above the error.

The database error is relation "public.TABLE" does not exist (42P01), or PostgREST returns PGRST205 "Could not find the table 'public.TABLE' in the schema cache".

Do not disable RLS. Do not grant the service role to the browser. Do not put a secret in NEXT_PUBLIC_ or VITE_. Do not swallow the error in an empty catch. Do not rename the table in the client to hide a missing migration.

1. Show the information_schema.tables row for this name, including table_schema. If there is no row, the migration did not run on this project.
2. Tell me to run the migration in the SQL Editor, or supabase db push against the linked project. Mention --dry-run before applying.
3. If the table exists and the API still returns PGRST205, tell me to run NOTIFY pgrst, 'reload schema'; in the SQL Editor.
4. If the schema is not public, use .schema('name') and say the schema must be in Exposed schemas. Do not invent a click path past that.
5. After the table is visible, enable RLS and add a real policy. Do not use a policy of true on private rows.
6. Change only the migration and the one query that names the missing table.

Common questions

+The table is in the Table Editor and the API still says PGRST205. Why?

PostgREST answers from its schema cache. Supabase's reload note says to run NOTIFY pgrst, 'reload schema'; in the SQL Editor. Also check that the table's schema is the one the client queries. public is the default. Another schema has to be selected on the query and listed in Exposed schemas.

+The SQL Editor can select the table and the app cannot. Is that RLS?

If the app body says relation does not exist or PGRST205, the API is not looking at that table yet. RLS and a missing GRANT both happen after the table is visible. The SQL Editor runs as a privileged role, so it is the wrong test for a policy.

Related errors