# Common self-hosted Supabase errors and how to fix them | Nuvits

Source: [https://nuvits.net/en/blog/common-self-hosted-supabase-errors](https://nuvits.net/en/blog/common-self-hosted-supabase-errors)

Published 2026-12-03, by Fernando Chagas.

Most self-hosted Supabase failures on a VPS trace back to four recurring issues: the Supavisor username format, Envoy gateway rules, editing `.env` without recreating containers, or changing `POSTGRES_PASSWORD` after the database directory was already initialized. Every error and fix below was reproduced on December 3, 2026 on Supabase `self-hosted/v0.8.6` (PostgreSQL `17.6.1.136`, Envoy `v1.39.6`, Supavisor `2.10.2`, GoTrue `v2.199.0`, PostgREST `v14.18`, and Studio `2026.11.30`) running on Ubuntu 24.04.5 LTS with the stack from [How to install self-hosted Supabase on an Ubuntu VPS](https://nuvits.net/en/blog/install-supabase-self-hosted-ubuntu-vps).

![Diagnostic table of the six most common self-hosted Supabase v0.8.6 errors with Envoy, Supavisor and Caddy: ENOIDENTIFIER and ENOTFOUND in psql, 401 Unauthorized and 403 RBAC access denied in Envoy, PGRST000 after changing POSTGRES_PASSWORD, ignored .env changes on docker compose restart, 503 no healthy upstream, and ports 5432 and 6543 exposed on the host](https://nuvits.net/blog/common-self-hosted-supabase-errors/self-hosted-supabase-error-diagnosis.webp)

## Quick diagnosis table

| Error or symptom | Most likely cause | First step |
| --- | --- | --- |
| `FATAL: (ENOIDENTIFIER) no tenant identifier provided` | Connecting on ports `5432`/`6543` without `.POOLER_TENANT_ID` | Change username to `postgres.<POOLER_TENANT_ID>` |
| `FATAL: (ENOTFOUND) tenant/user ... not found` | Tenant suffix does not match `.env` | Check `POOLER_TENANT_ID` in `.env` |
| `Unauthorized` (`HTTP 401`) on API routes | Missing, invalid, or out-of-sync `apikey` header | Verify keys with `sh run.sh secrets` and recreate `api-gw` |
| `RBAC: access denied` (`HTTP 403`) on `/rest/v1/` | OpenAPI root route requires secret key in Envoy | Test `/rest/v1/<table>` or use `SUPABASE_SECRET_KEY` |
| `PGRST000` / `password authentication failed for user "authenticator"` | `POSTGRES_PASSWORD` edited in `.env` after initial bootstrap | Sync all 7 internal Postgres roles via `ALTER USER` |
| `.env` change ignored after `restart` | `docker compose restart` does not reload `env_file` | Recreate with `sudo sh run.sh recreate <service>` |
| `no healthy upstream` (`HTTP 503`) | Upstream service starting, crashing, or OOM-killed | Check `sh run.sh status`, logs, and `OOMKilled` |

## 1. `ENOIDENTIFIER` or `ENOTFOUND` on PostgreSQL ports 5432 and 6543

When connecting with `psql`, DBeaver, Prisma, or Drizzle through Supavisor (port `5432` in session mode or `6543` in transaction mode), using the bare username `postgres` fails with:

```text
FATAL:  (ENOIDENTIFIER) no tenant identifier provided (external_id or sni_hostname required)
```

Passing a tenant ID that does not match `.env` fails with:

```text
FATAL:  (ENOTFOUND) tenant/user postgres.wrong-tenant not found
```

### How to fix it

Read the exact `POOLER_TENANT_ID` configured in `.env`:

```bash
cd ~/supabase
grep '^POOLER_TENANT_ID=' .env
```

Always pass `postgres.<POOLER_TENANT_ID>` as the username in your connection string (for example, `postgres.my-project`):

```bash
psql "postgresql://postgres.my-project:YOUR_PASSWORD@127.0.0.1:5432/postgres"
```

If you changed `POOLER_TENANT_ID` after first startup, recreate the pooler (`sudo sh run.sh recreate supavisor`) so Supavisor registers the updated tenant.

## 2. `HTTP 401 Unauthorized` and `HTTP 403 RBAC: access denied` from Envoy

In the current Supabase Compose stack, Envoy (`api-gw`) replaced Kong and enforces API key checks before routing to PostgREST, GoTrue, and Storage. Two different status codes frequently trip people up during smoke tests:

- **`HTTP 401` (`Unauthorized`):** the `apikey` header is missing, wrong, or out of sync because `generate-keys.sh` / `add-new-auth-keys.sh` ran without recreating the containers.
- **`HTTP 403` (`RBAC: access denied`) on `GET /rest/v1/`:** the exact `/rest/v1/` path returns the full OpenAPI schema, and Envoy's `rest-v1-openapi-protected` rule restricts it to `SUPABASE_SECRET_KEY` or `SERVICE_ROLE_KEY`. Sending `SUPABASE_PUBLISHABLE_KEY` or `ANON_KEY` to `/rest/v1/` always returns `403`, even when the stack is completely healthy.

### How to fix it

Test your publishable key (`SUPABASE_PUBLISHABLE_KEY` or `ANON_KEY`) against `/auth/v1/health` or an actual table path (`/rest/v1/<table>`), and use `SUPABASE_SECRET_KEY` only when fetching the OpenAPI root:

```bash
# Confirms Caddy -> Envoy -> GoTrue with the publishable key
curl -fsS https://supabase.example.com/auth/v1/health \
  -H "apikey: YOUR_SUPABASE_PUBLISHABLE_KEY"

# Confirms PostgREST OpenAPI with the secret key (never expose in frontend code)
curl -fsS https://supabase.example.com/rest/v1/ \
  -H "apikey: YOUR_SUPABASE_SECRET_KEY" | head -c 200
```

If `/auth/v1/health` also returns `401`, check the active keys with `sh run.sh secrets` and recreate the gateway and Auth containers:

```bash
sudo sh run.sh recreate api-gw auth rest
```

## 3. `PGRST000` and `password authentication failed` after changing `POSTGRES_PASSWORD`

Editing `POSTGRES_PASSWORD` in `.env` after `volumes/db/data` already exists does not change any password inside PostgreSQL. Once containers are recreated, PostgREST, Auth, Storage, and Supavisor connect with the new password while Postgres still expects the original one. In `supabase-rest` logs, you will see:

```text
FATAL:  password authentication failed for user "authenticator"
Failed to establish a connection. {"code":"PGRST000",...,"message":"Database connection error."}
```

### How to fix it

Without wiping your database, update all seven internal roles directly inside `supabase-db` (the init scripts in `volumes/db/roles.sql` assign the same password to these roles):

```bash
cd ~/supabase
NEW_PASS="$(grep '^POSTGRES_PASSWORD=' .env | head -n1 | cut -d= -f2-)"

sudo docker exec -i supabase-db psql -U supabase_admin -d postgres -v pgpass="$NEW_PASS" <<'SQL'
ALTER USER postgres WITH PASSWORD :'pgpass';
ALTER USER supabase_admin WITH PASSWORD :'pgpass';
ALTER USER authenticator WITH PASSWORD :'pgpass';
ALTER USER pgbouncer WITH PASSWORD :'pgpass';
ALTER USER supabase_auth_admin WITH PASSWORD :'pgpass';
ALTER USER supabase_functions_admin WITH PASSWORD :'pgpass';
ALTER USER supabase_storage_admin WITH PASSWORD :'pgpass';
SQL

sudo sh run.sh recreate rest auth storage meta supavisor
```

> **Do not run `source .env` on Supabase.** The official `.env.example` contains unquoted values with spaces (`STUDIO_DEFAULT_ORGANIZATION=Default Organization` and `STUDIO_DEFAULT_PROJECT=Default Project`). Sourcing it with `. ./.env` fails with `Organization: command not found`. Read individual keys with `grep '^KEY=' .env` or use `sh run.sh secrets` and `sh run.sh printenv <service>`.

## 4. `.env` edits ignored (and Auth redirecting to `localhost`)

A common trap: you update `SUPABASE_PUBLIC_URL`, `API_EXTERNAL_URL`, or `SITE_URL` in `.env` to replace `http://localhost:8000` or `http://localhost:3000`, run `docker compose restart`, and Studio still hits CORS/Mixed Content errors or Auth keeps redirecting to `localhost`.

In our test, editing `SITE_URL` and running `docker compose restart auth` left `GOTRUE_SITE_URL` unchanged. `restart` only restarts the process inside the existing container using the environment captured at creation time.

### How to fix it

Recreate the affected containers and verify the live environment variable:

```bash
cd ~/supabase
sudo sh run.sh recreate studio auth api-gw
sudo sh run.sh printenv auth | grep -E '^(GOTRUE_SITE_URL|API_EXTERNAL_URL)='
```

Double-check that `API_EXTERNAL_URL` ends with `/auth/v1` (for example, `https://supabase.example.com/auth/v1`) and that your frontend origin is listed under `ADDITIONAL_REDIRECT_URLS`.

## 5. `HTTP 503 no healthy upstream` or containers restarting in a loop

Envoy returns `HTTP 503` with body `no healthy upstream` whenever the target service (`auth`, `rest`, `storage`, `functions`, or `realtime`) is stopped, still booting, or was killed by the kernel. Releases prior to `self-hosted/v0.8.6` (November 30, 2026) also hit an Envoy DNS caching bug that left `/functions/v1` returning `503` for about two minutes after startup (fixed in PR `#54197`).

### How to fix it

Find which container is not `Up (healthy)`, inspect its logs, and check whether the kernel terminated it for running out of memory (`OOMKilled`):

```bash
cd ~/supabase
sudo sh run.sh status
sudo docker logs --tail=50 supabase-auth
sudo docker inspect --format '{{.Name}} OOMKilled={{.State.OOMKilled}} Exit={{.State.ExitCode}}' $(sudo docker compose ps -aq)
```

If any container reports `OOMKilled=true`, the server is undersized for the 12-container stack. On 2 GB or 4 GB servers under real traffic, move to an 8 GB or larger [Linux VPS](https://nuvits.net/en/linux-vps); compare specs on the [VPS plans page](https://nuvits.net/en/vps).

If you see `502 Bad Gateway` from Caddy instead of `503` from Envoy, follow the proxy troubleshooting steps in [Fix Caddy 502 Bad Gateway and HTTPS errors with Docker](https://nuvits.net/en/blog/fix-caddy-docker-502-bad-gateway-https-vps).

## 6. Studio asking for a password (`401`) and ports `5432`/`6543` open with `ufw`

With `docker-compose.caddy.yml`, getting `HTTP/2 401` (`www-authenticate: Basic realm="restricted"`) on `GET /` is expected: Caddy enforces `DASHBOARD_USERNAME` and `DASHBOARD_PASSWORD` before forwarding to Studio (valid credentials return `307` to `/project/default`). If you change Studio credentials in `.env`, recreate Caddy (`sudo sh run.sh recreate caddy`) so it regenerates `/config/dashboard-auth`.

On database ports, the Caddy override clears port `8000` from Envoy, but leaves `supavisor` publishing `5432` and `6543` on `0.0.0.0`, bypassing `ufw` (see [The Docker port stays open with ufw](https://nuvits.net/en/blog/docker-port-still-open-with-ufw)).

### How to check and lock them down

List the listening ports on the host:

```bash
sudo ss -tulpn | grep -E ':(80|443|5432|6543|8000|3000)\b'
```

If `5432` or `6543` shows up on `0.0.0.0` or `*`, add the `docker-compose.local-db.yml` override binding Supavisor to `127.0.0.1` (from the [self-hosted Supabase installation guide](https://nuvits.net/en/blog/install-supabase-self-hosted-ubuntu-vps)) and activate it with `sh run.sh config add local-db && sudo sh run.sh start`.

## Next steps

- For the complete production setup with Envoy, Caddy HTTPS, SSH tunneling, and backups, read [How to install self-hosted Supabase on an Ubuntu VPS](https://nuvits.net/en/blog/install-supabase-self-hosted-ubuntu-vps).
- If you run Supabase alongside other containerized apps or a deployment panel, review memory headroom on our [Docker VPS](https://nuvits.net/en/docker-vps) and [VPS for Coolify](https://nuvits.net/en/coolify-vps) pages.
