Skip to content

Supabase API errorSupabase: “Could not find the function in the schema cache” (PGRST202)

supabase.rpc() returns a 404 with code PGRST202: could not find the function public.my_fn(...) in the schema cache. The Supabase API looks functions up by name and by the names of the arguments you send. If the names do not match a function it knows about, it answers PGRST202, even when the function exists.

Short answer

Send exactly the argument names the SQL function declares, all of them unless they have defaults. Then reload the API’s schema cache with NOTIFY pgrst, 'reload schema'. If it still fails, check the function is in an exposed schema and in the same project your app uses.

Why the function is not found, and the fix

  1. 01

    The argument names do not match

    “The function parameter names match the JSON object keys in the POST case” GitHub, PostgREST docs: Functions as RPC

    Arguments are matched by name, not position. rpc('add_item', { item_id: 1 }) only finds a function whose parameter is called item_id. A parameter named p_item_id, a missing argument without a default, or extra keys all give PGRST202. The error’s hint may name the closest match.

    -- SQL
    create function add_item(p_item_id bigint) returns void ...
    
    // JS: use the SQL parameter names
    await supabase.rpc('add_item', { p_item_id: 1 });
  2. 02

    The name has capital letters

    Postgres lowercases unquoted names, so create function addItem(...) makes a function called additem, and rpc('addItem') does not find it. Use snake_case names for functions you call from the API.

  3. 03

    The schema cache is stale

    “Caused by a stale function signature, otherwise the function may not exist in the database.” Supabase, PostgREST error codes (PGRST202)

    After you create or change a function, the API may still use the old list. Reload it from the SQL editor.

    NOTIFY pgrst, 'reload schema';
  4. 04

    The function is in another schema

    “When multiple schemas are exposed, the first entry in the list is treated as the default, so PostgREST resolves unqualified object names only against that schema.” Supabase, PostgREST not recognizing objects in schema

    A function in a schema other than public needs that schema exposed in the API settings, and the call has to name it with .schema('name').rpc(...).

  5. 05

    The function exists only in another project

    A migration that ran on your local or staging database but not on production leaves the function missing where the app points. Check in the SQL editor of the project the app uses.

    select proname, pg_get_function_arguments(oid)
    from pg_proc where proname = 'add_item';
  6. 06

    Calling it from the client

    “If the function is defined to have default values for the parameters then arguments for these parameters can be omitted in the request.” GitHub, PostgREST docs: Functions as RPC

    The second argument to rpc() is the object of named arguments. You can leave out only the arguments whose parameters have defaults in SQL.

Checked against the vendor’s docs on : Supabase docs: PostgREST error codes; Supabase troubleshooting: Reload the PostgREST schema; Supabase troubleshooting: Objects in an exposed schema; Supabase reference: JavaScript rpc; PostgREST docs: Functions as RPC.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Supabase “Could not find the table in the schema cache” · Supabase PGRST116 · Supabase migration failed (db push) · Supabase permission denied for schema auth

Questions

More on this error

Why does it work in the SQL editor but not from the app?

In SQL you usually call the function by position, so a wrong parameter name never matters. The API matches by name, so a mismatch only shows up from rpc().

What is PGRST203?

A related error: two overloaded functions with the same argument names but different types. Rename one function or its arguments.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.