# Troubleshooting

# Troubleshooting

Five common failures and their fix. For anything else, start with container logs (`docker compose logs --follow api`) and the Jobs screen in Settings.

## 1. api refuses to boot: "OIDC_* is required"

Symptom: the `api` container exits during startup with an error naming one of `OIDC_ISSUER`, `OIDC_AUDIENCE`, `OIDC_CLIENT_ID`, `OIDC_SCOPES`, or `OIDC_JWKS_URL`.

Cause: Drillmark has no local login; all five OIDC values are required, since standalone / local-auth mode was removed.

Fix: fill the `OIDC_*` block in `.env` per [getting-started](/docs/drillmark/getting-started), register Drillmark as a public PKCE `oauth_clients` row at your Bunyip / mokosh-server, and restart the stack. See the inline comment in `.env.example` for the row shape.

## 2. api refuses to boot: migration previously applied but has been modified

Symptom: startup aborts with a SeaORM migration mismatch error.

Cause: a committed migration file in `migration/` was edited after it ran against this database. SeaORM verifies a checksum on every boot and refuses to proceed if a committed migration's contents changed.

Fix: do not edit committed migrations. Add a new migration that corrects the schema forward and restart. For a database restored from a backup that is ahead of the running image, pin the api to an image version that matches the database's migration state before rolling forward.

## 3. All emails for one data source land in the failed folder

Symptom: the Jobs screen shows the incoming-queue job completing, but every message for one data source moves to `failed` with a parse or auth error.

Cause, most often: IMAP credentials rotated upstream; the stored `encrypted_password` no longer authenticates. The job records the failure per source but keeps running against the others.

Fix: open the data source from Settings, re-enter the password (it is re-encrypted with `ENCRYPTION_KEY`), and save. Once auth succeeds, the failed-queue job on its next run promotes everything out of `failed` that parses correctly.

Secondary cause: a vendor changed the attachment compression. Drillmark handles gzip only today; a report sent uncompressed or under a different compression lands in `failed`.

## 4. Country rollups and the world map are blank

Symptom: the Countries screen shows no data even though records are coming in.

Cause: either `IP2LOCATION_DB_PATH` is unset (the geolocation job never runs), the path points at a file that is not readable by the container user, or the file is a different IP2Location format than DB11.

Fix: set `IP2LOCATION_DB_PATH` to the absolute path of an IP2Location LITE DB11 binary, mount the file read-only into the container, and restart. The geolocation job enriches new IPs in batches of 1000 and backfills existing ones over successive runs.

## 5. Alerts stopped arriving

Symptom: the UI shows alerts in `alerts_sent` with recent timestamps, but no email arrives.

Cause, most often: SMTP credentials expired or the relay changed. The alerts-generation job records the alert row before dispatch, so the UI sees fired alerts even when delivery is broken.

Fix: check `api` stdout for the SMTP warning line that accompanies the failure. Update `SMTP_HOST` / `SMTP_PORT` / `SMTP_SECURITY` / `SMTP_USERNAME` / `SMTP_PASSWORD` in `.env` and restart the stack. Verify by firing a test alert.

Secondary cause: the alert recipient on the tenant's channel points at a non-routable domain (`example.com`, `.invalid`, `.localhost`, `.test`). Drillmark writes those to `TRANSACTIONAL_OUTBOX_DIR` instead of sending; check `tmp/outbox` on the api container.
