# Troubleshooting

> Every startup refusal and run-time symptom, with its cause and fix.

From `docs/server.md` in tensile-tools/tensile-auth at commit `e66760d` (v0.4.1-7-ge66760d). The HTML page is https://auth.tensile.tools/docs/server/troubleshooting.

The server exits with status 1 and a message that names the setting and the fix. `tensile-auth-server check` prints every refusal at once.

| Message starts with | Cause and fix |
|---|---|
| `the server runs as root (UID 0)` | Run as an unprivileged user. The image runs as 65532; don't override it with `--user 0` |
| `origins is missing` | Set `TENSILE_AUTH_ORIGINS` to the app's public origins |
| `origin … uses http://` | Passkeys and `Secure` cookies need `https://` outside localhost. Use the app's public `https://` origin, not the server's address |
| `rp_id … isn't the host of origin` | `rp_id` must be every origin's host or a parent domain of it. Unset it to use the first origin's host |
| `rp_id … isn't a registrable domain` | Use a host with a dot, such as `app.example.com` |
| `database_url is missing` | Set `TENSILE_AUTH_DATABASE_URL_FILE`. For a single node, use `sqlite:///absolute/path` |
| `database_url: a SQLite URL needs an absolute path` | Write three slashes and an absolute path: `sqlite:///var/lib/tensile-auth/auth.db` |
| `postgres doesn't answer after 30s of retries` | Check the URL, the network between the server and Postgres, and that Postgres runs |
| `the database's library schema is version …, newer than this binary's` | The database was migrated by a newer release. Run that release or a later one |
| `migrate is check and migrations are pending` | Run `tensile-auth-server migrate` with the new image, then start the servers |
| `master_key is missing` | Set `TENSILE_AUTH_MASTER_KEY_FILE` to a file holding 32 random bytes in base64 |
| `master_key isn't 32 bytes in standard base64` | Generate one with `openssl rand -base64 32`. Check that the file has no extra characters other than a trailing newline |
| `master_key doesn't open the key-check value` | The key isn't the one this database first started with. Restore the right key; after `keys rewrap`, every replica needs the new one |
| `preset … has no passwords, but passwords.enabled is true` | Set `passwords.enabled` to `false` with `passkey-only@1`, or choose a preset with passwords |
| `passwords are on without passwords.mailer_url` | Set the mailer URL, or turn passwords off |
| `… uses http:// outside loopback` | `hooks.url`, `webhooks.url`, and an `https` mailer must use `https://` |
| `rate_limits.backend is memory on Postgres` | Replicas wouldn't share counters. Use `postgres` or a `redis://` URL |
| `listen and ops_listen are the same address` | Give the ops port, which serves [`/livez` and `/readyz`](/docs/server/operate#monitor), its own address |
| An unknown key or variable | Fix the spelling; the server names the key. A variable for a setting that this release doesn't have is refused too |

At run time:

| Symptom | Cause and fix |
|---|---|
| Every unsafe `/auth/` request from the browser answers 403 `cross_origin` | The page's origin isn't in `origins`, for example `https://www.example.com` beside `https://example.com`. Add every origin people reach the app on |
| Passkey sign-in fails in the browser with a relying party error | `rp_id` doesn't match the page's host. Users must reach the app on an origin in `origins` |
| `/v1/check` answers 401 `app_key_invalid` | The app key was revoked or mistyped. Create one with `app-key create NAME` |
| Every person is throttled at once | The server sees one client address for everyone. Behind the SDK's proxy, pass the client's address to the proxy so that it sends `Tensile-Client-IP`. Behind another proxy, set `trusted_proxies` and forward `X-Forwarded-For`. See [Put the server behind the app's proxy](/docs/server/reverse-proxy) |
| `/readyz` reports `cache_watcher` | The server lost its `LISTEN` connection to Postgres. It bypasses the cache until it reconnects; check connection limits and idle timeouts on any pooler in between |
| Sign-up answers 202, but no email arrives | The mailer failed, and the log says why after `the mailer failed`. An `smtp://` server without STARTTLS is refused outside loopback; see [Mail](/docs/server/configure#mail) |
| Sign-ups answer 429 `throttled` while you test | The sign-up limit for your address applies; see [Rate limits](/docs/server/configure#rate-limits). Restart the server to clear counters kept in memory |
| Sign-ups answer 503 `unavailable` with `hooks.url` set | The sign-up hook failed or answered unsigned. Check the app's logs, and that it signs with a live secret from `keys webhook-secret` |
| A `webhook_late` alert | `webhooks.url` doesn't answer 2xx within 10 seconds. Fix the endpoint; delivery resumes from the failing event |
| Accepting an invitation answers 404 `not_found` | The invitation expired after 15 minutes or was used. Run `admin invite` again |
| The admin API answers 404 everywhere | The client's address is outside `admin.allowed_networks` |

Every problem a client can see is in the [error catalog](/docs/reference/errors), with its status and fix.
