What it means
Two layers, two messages. PGRST202 comes from the Supabase API (PostgREST): it looked for a function with that name and those argument names and found none. 42883 comes from Postgres itself: a function with that name exists, maybe, but not one that accepts those argument types.
PGRST202: the argument names don't match
supabase.rpc() sends your arguments as a JSON object, and the API matches the keys to the function's parameter names. Positions don't matter; names must match exactly. Every key must be a parameter, and every parameter without a default must be present.
-- the function
create function public.get_orders(p_user_id uuid, p_limit int default 20) ...
// wrong: key "user_id" is not a parameter name
await supabase.rpc('get_orders', { user_id: id });
// right
await supabase.rpc('get_orders', { p_user_id: id });
await supabase.rpc('get_orders', { p_user_id: id, p_limit: 50 });The error's details field lists the names it searched with, which makes the mismatch easy to spot.
PGRST202: other causes
- The function is in a schema the API doesn't expose (for example
private). Only schemas listed under Exposed schemas are callable. - It was just created and the API schema cache hasn't reloaded. Run
notify pgrst, 'reload schema'; - Wrong project: the migration ran on staging, the app calls production.
PGRST203: two functions with the same name
If you created the function twice with different parameter types (for example once with int, once with bigint), the API can't choose and returns Could not choose the best candidate function between: …. Drop the version you don't need. Remember create or replace with a different argument list creates a new overload instead of replacing the old one.
42883: the argument types don't match
From SQL, triggers or other functions, Postgres matches on types. Common cases: passing a bigint to an int parameter, or a text variable to a uuid parameter. These have no implicit cast, so add one:
select public.get_orders(v_user_id::uuid, 20);See what actually exists
select p.oid::regprocedure as signature,
pg_get_function_identity_arguments(p.oid) as arguments
from pg_proc p
join pg_namespace n on n.oid = p.pronamespace
where n.nspname = 'public' and p.proname = 'get_orders';One row with the parameter names your client sends is what you want. Two rows means an overload to drop.
Renaming parameters
create or replace function refuses to rename an existing parameter (cannot change name of input parameter). Drop the old signature first, in the same migration, then create the new one and grant execute again:
drop function if exists public.get_orders(uuid, int);
-- create function public.get_orders(...) ...
grant execute on function public.get_orders(uuid, int) to authenticated;How to verify
The catalog query shows exactly one signature, and the same rpc() call returns data. If it now fails with permission denied for function, the function was found and only the EXECUTE grant is missing.
Related guides
- “relation does not exist” in Postgres and Supabase – schema, quotes, search_path, cache
- SECURITY DEFINER functions without a fixed search_path – the risk and the fix
- Supabase “permission denied for table” – a missing GRANT, not a missing policy
- Postgres “new row for relation … violates check constraint” – find the rule and fix it
More in Postgres errors and performance · all guides