AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Intermittent PGRST002 Schema Cache Error On Official Supabase When Querying Public Schema

Users on official Supabase experience intermittent PGRST002 errors ("Could not query the database for the schema cache") when making supabase-js queries against the public schema. The error is transient but disrupts application availability.

highConfidence 65%Supabase-JsEdge FunctionspgvectorStorageAffected Vsupabase-Js@2.39.8

Origin Analysis

PostgREST intermittently fails to query its schema cache from the database, likely because the schema introspection connection times out or is dropped under concurrent load or during a database restart. This causes subsequent requests to return PGRST002 until the cache reload succeeds.
1. Create a Supabase project on the official platform.\n2. Use supabase-js 2.39.8 from a Node.js client.\n3. Send repeated SELECT queries to a table in the public schema.\n4. Observe intermittent errors with code PGRST002 and message \"Could not query the database for the schema cache\".\n5. The error occurs more frequently under higher concurrency or during database maintenance events.

Fixing Code Block

Edge Case Audit

Retrying may increase load on the database and PostgREST, potentially worsening connection pool exhaustion if that is the underlying cause. Use moderate retry counts and backoff. Monitor database connection counts and PostgREST logs. If the error persists after retries, fall back to a circuit breaker. Server-side fixes should be prioritized; test any configuration changes in a staging environment before rolling back to previous settings.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state