# PGRST106: "The schema must be one of the following..." error when querying an exposed schema

You may encounter a `PGRST106` error, stating `{"code":"PGRST106","message":"The schema must be one of the following: public"}`, when attempting to query a schema via the [PostgREST API](https://supabase.com/docs/guides/api) that you've recently exposed.

**Why This Happens:**
This error occurs because the `authenticator` role's `pgrst.db_schemas` setting does not include the desired schema. This creates a conflict, as PostgREST relies on this setting to know which schemas it should expose.

**How to Resolve This:**
To fix this, you need to update the `pgrst.db_schemas` setting for the `authenticator` role. Connect to your database and execute one of the following SQL commands:

- **To check the current configuration for selected roles:**
  `SELECT rolname, rolconfig FROM pg_roles WHERE rolname IN ('authenticated', 'authenticator', 'anon', 'postgres', 'service_role');`

- **To explicitly add your schema:**
  If you want to add your specific schema (e.g., `your_schema_name`) alongside existing schemas (like `public`), use the following command. Remember to replace `your_schema_name` with your actual schema name and include all other necessary schemas already defined.
  `ALTER ROLE authenticator SET pgrst.db_schemas = 'public, your_schema_name';`

- **To reset to [dashboard configuration](https://supabase.com/dashboard/project/_/settings/api):**
  Alternatively, you can reset this setting to allow the Supabase dashboard's configuration to take effect automatically.
  `ALTER ROLE authenticator RESET pgrst.db_schemas;`

## Related topics

- [Using custom schemas](https://supabase.com/docs/guides/api/using-custom-schemas)
- [PostgREST error codes](https://supabase.com/docs/guides/api/rest/postgrest-error-codes)
- [PostgREST not recognizing objects in a schema](https://supabase.com/kb/troubleshooting/postgrest-not-recognizing-objects-in-schema)
- [PGRST002: Could not query the database for the schema cache](https://supabase.com/kb/troubleshooting/postgrest-error-pgrst002-could-not-query-the-database-for-the-schema-cache)
- [Refresh the PostgREST schema cache](https://supabase.com/kb/troubleshooting/refresh-postgrest-schema)
