Fix guide · updated 2026-11-15
Supabase "Invalid path specified in request URL" (PGRST125)
404 · {"code":"PGRST125","details":null,"hint":null,"message":"Invalid path specified in request URL"}
Sign-up fails, login fails, or a database query comes back with "Invalid path specified in request URL", sometimes with the code PGRST125. The message comes from PostgREST, the part of Supabase that answers database requests at /rest/v1/. It means your app called an address with the wrong shape. Most of the time it's one setting, the Supabase URL in your app, and the fix takes a few minutes.
What the error means
After /rest/v1/, PostgREST accepts only three shapes of address:
- one table or view name:
/rest/v1/todos rpc/and one function name:/rest/v1/rpc/my_function- nothing at all (the API's own description)
Anything else gets a 404 with the code PGRST125 and this message, whatever the method: GET, POST, PATCH or DELETE. Filters, sorting and paging go after the ?, never in the path. We ran PostgREST 14.18, the version in Supabase's self-hosted setup: /todos/5, /todos/, /api/todos and /rest/v1/todos all got PGRST125, while /todos?id=eq.5 worked.
So open your browser's developer tools, Network tab, make the error happen again, and look at the failing request's address:
/rest/v1/appears twice, or/auth/v1/or/storage/v1/comes after it: see section 1.- An id or a schema name in the path, like
/rest/v1/todos/5: see section 2. - A slash at the end, or an address your code builds by hand: see section 3.
1. Your app's Supabase URL ends with /rest/v1
The Supabase client needs the Project URL alone, like https://abcdefghijklmnopqrst.supabase.co. But the Supabase dashboard also shows an API URL, on Project Settings → Data API, and that one ends with /rest/v1/. Paste it into your app and the client puts it in front of every request. We tested it with supabase-js 2.119.0:
- a query goes to
…supabase.co/rest/v1/rest/v1/todos - sign-up goes to
…/rest/v1/auth/v1/signup, login to…/rest/v1/auth/v1/token - a Storage call goes to
…/rest/v1/storage/v1/…
All of them land on PostgREST, which answers PGRST125. That's why a login form can show a database error: signUp and signInWithPassword return an AuthApiError with this message and status 404. Edge Function calls only say "Edge Function returned a non-2xx status code", with the same message in the response behind it (how to read it).
The fix:
- Copy the Project URL: click Connect at the top of your Supabase dashboard, or look on your project's home page. It ends with
.supabase.co, with nothing after it. - Put it where your app reads it. Lovable:
src/integrations/supabase/client.tsorVITE_SUPABASE_URL. Bolt and other Vite apps:VITE_SUPABASE_URL. Next.js:NEXT_PUBLIC_SUPABASE_URL. - Hosting on Vercel or Netlify? Fix the variable there too, then redeploy: the build bakes the value into your app.
To make this mistake loud next time, check the address before you create the client. A wrong value then fails at startup with a clear message, not at login with a cryptic one:
const url = import.meta.env.VITE_SUPABASE_URL;
// The Project URL only: https://<project-ref>.supabase.co, nothing after it
if (new URL(url).pathname !== '/') {
throw new Error(`VITE_SUPABASE_URL has a path, use the Project URL only: ${url}`);
}
In Next.js, use process.env.NEXT_PUBLIC_SUPABASE_URL. The check also accepts a custom domain, since it only looks at what comes after the domain.
2. An id or a schema name in the path
Supabase's database API doesn't take ids in the path, the way many REST APIs do: /rest/v1/todos/5 doesn't exist. The id goes in a filter. This catches hand-written fetch calls and the HTTP steps of n8n, Make or Zapier:
GET /rest/v1/todos?id=eq.5
PATCH /rest/v1/todos?id=eq.5 body: {"done": true}
DELETE /rest/v1/todos?id=eq.5
Keep the filter on every PATCH and DELETE: it's what limits the change to that one row. With supabase-js, from() takes a table name only:
// Wrong: PGRST125
await supabase.from('todos/5').select();
// Right
await supabase.from('todos').select().eq('id', 5);
await supabase.from('todos').update({ done: true }).eq('id', 5);
Same for a schema: /rest/v1/api/todos and from('api/todos') both get PGRST125. The schema goes in a header. With supabase-js, write supabase.schema('api').from('todos'). With plain HTTP, send Accept-Profile: api on GET and Content-Profile: api on POST, PATCH and DELETE. The schema must also be in the Exposed schemas list, on Project Settings → Data API. If it isn't, the error becomes PGRST106 "Invalid schema: api".
3. A slash too many, or another service's path
A slash at the end also gets PGRST125: /rest/v1/todos/ or /rest/v1/rpc/my_function/. It usually comes from code that builds the address by hand, like `${SUPABASE_URL}/rest/v1/${table}/`. Remove the last slash.
Each Supabase service has its own address, right after .supabase.co: /rest/v1/ for the database, /auth/v1/ for logins, /storage/v1/ for files and /functions/v1/ for Edge Functions. An Edge Function or Storage address placed behind /rest/v1/ gets PGRST125, because PostgREST reads it as a table address.
Which "path" error do you have?
- "Invalid path specified in request URL" (PGRST125): the request reached the database API, but the address has the wrong shape. This page.
{"error":"requested path is invalid"}: the address matches no Supabase service at all, often a login or email link that sends people to your Supabase address. See Supabase "requested path is invalid".- "Could not find the table 'public.todos' in the schema cache" (PGRST205): the shape is right, the name isn't. Check the spelling, the schema, and that the table exists: see Supabase "Could not find the table" (PGRST205).
- "Invalid schema" (PGRST106): the schema isn't exposed (section 2).
If an AI tool built your app
Give your AI tool this prompt:
Find where the Supabase client is created and where its URL comes from (.env, client.ts or a hardcoded value). The URL must be the Project URL only, like https://<project-ref>.supabase.co, with nothing after .supabase.co: remove any /rest/v1 or other path, and add a check at startup that throws a clear error if the URL has a path. Then find every hand-written call to /rest/v1/ (fetch, axios, webhooks): the path must be /rest/v1/<table> or /rest/v1/rpc/<function>, with no id or schema in the path (ids go in filters like ?id=eq.5, schemas in the Accept-Profile or Content-Profile header) and no slash at the end. In supabase-js, from() must get a table name only. Don't change anything else.
Then fix the same variable in your host's settings (Vercel, Netlify) and redeploy.
Still stuck?
Take the failing address from the Network tab and remove https://<project-ref>.supabase.co/rest/v1/ from the front. What's left, up to the ?, must be a table name, or rpc/ and a function name. Anything else, even one extra slash, is the bug.
Other Supabase problems? See Supabase fixes.