# Troubleshoot an instance

Source: https://dropshelf.ai/docs/self-host/operate/troubleshooting

Symptoms and errors an operator meets when running dropshelf, what causes each, and how to fix it.

When you run a dropshelf instance, you might see the following problems. Most of them show first in
the answer of `/readyz`, the readiness probe, so read it before you search the logs.

To read `/readyz` from a pod, forward its port and ask:

```bash
kubectl -n dropshelf port-forward pod/<pod> 8080:8080
curl -i http://127.0.0.1:8080/readyz
```

`<pod>` is a name from `kubectl -n dropshelf get pods`. Run `curl` in a second terminal while the
port forward runs.

## The server exits at startup with a `config:` message [#the-server-exits-at-startup-with-a-config-message]

When the configuration is wrong, the server writes one message and exits before it listens. On
Kubernetes the pod goes into `CrashLoopBackOff`, and its log holds the message:

```bash
kubectl -n dropshelf logs deploy/dropshelf --previous
```

`dropshelf-server migrate` checks the configuration the same way, so a migration Job fails with the
same message.

### `config: <old-key> was renamed to <new-key>` [#config-old-key-was-renamed-to-new-key]

The server refuses a configuration that still names a renamed key, and names the key to use:

```text
config: limits.maxSitesPerUser was renamed to limits.maxDropsPerUser
```

This happens when your values file, config file or environment uses an old key name. For an
environment variable, the message names the variables:

```text
config: DROPSHELF_RETENTION_ALLOW_PINNED was renamed to DROPSHELF_RETENTION_ALLOW_FOREVER
```

To fix it:

1. Replace the old key with the one the message names, keeping its value.
2. Run `helm upgrade` with your values file, or restart the container on a single host.

### `field <key> not found in type config.<section>` [#field-key-not-found-in-type-configsection]

The server refuses a key it does not know:

```text
config: yaml: unmarshal errors:
  line 3: field spoolDirectory not found in type config.ServerConfig
```

This happens when a key under the chart's `config` block, or in the config file, is misspelt or
placed in the wrong section.

To fix it:

1. Find the key at the line the message names.
2. Correct it against the [configuration reference](/docs/reference/configuration).

### `config: unset environment variables referenced` [#config-unset-environment-variables-referenced]

```text
config: unset environment variables referenced: DROPSHELF_DATABASE_URL
```

This happens when the configuration names a variable as `${VARIABLE}` and the container does not
have it, usually because the Secret lacks that key.

To fix it:

1. Add the key to the Secret named in `secrets.existingSecret`.
2. Restart the pods: `kubectl -n dropshelf rollout restart deployment/dropshelf`.

### A list of required settings [#a-list-of-required-settings]

```text
config: server.baseDomain is required
        database.url is required, for example postgres://user:pass@host/db?sslmode=require
        auth.session.secrets requires at least one secret when auth.provider is oidc
```

This happens when settings the server needs are missing or invalid. The message lists every
problem, one per line.

To fix it:

1. Set each setting the message names. The [configuration reference](/docs/reference/configuration)
   marks every required key.
2. Restart the pods, or run `helm upgrade`.

## `image.tag "latest" is a floating tag` [#imagetag-latest-is-a-floating-tag]

`helm install` or `helm upgrade` fails before it changes anything, with a message that contains:

```text
image.tag "latest" is a floating tag; name a release, because a moving tag turns a node reschedule into a mixed-version rollout
```

This happens when `image.tag` is `latest`, `dev`, `edge`, `stable`, `main`, `master` or `nightly`.

To fix it:

1. Set `image.tag` to a release, such as `v0.5.0`, or remove it so the chart uses its own release.
2. Run the Helm command again.

## A pod is running but not ready [#a-pod-is-running-but-not-ready]

`kubectl get pods` shows the pod running but not ready, and Kubernetes has taken it out of the
Service. `/healthz` still answers, so the pod is not restarted. `/readyz` names the dependency that
failed. If every replica fails at once, the cause is the dependency; if one fails, it is that pod.

### `not ready: store: ...` [#not-ready-store-]

```text
not ready: store: ...
```

This happens when the database does not answer a trivial query: Postgres is unreachable, the
credentials are wrong or the connection pool is exhausted. The dashboard and the API fail with it,
because every request reads the member's record.

To fix it:

1. Check that the pod can reach the host in `DROPSHELF_DATABASE_URL`, and that the credentials work.
2. Check the database's own health and connection limit.

### `not ready: blob: ...` [#not-ready-blob-]

```text
not ready: blob: s3: head bucket <bucket>: ...
```

This happens when the object store does not answer for the bucket or container. The usual causes are
a misspelt bucket name, an endpoint that is not the bucket's, or credentials that cannot reach it.
On S3, the probe asks for the bucket itself, so the credentials need `s3:ListBucket` besides the
object permissions. On Google Cloud Storage and Azure, the message starts with `gcs: health:` or
`azure: health:`.

The dashboard keeps working. Drops answer 503 for files that are not in the pod's cache.

To fix it:

1. Check `storage.s3.bucket`, `storage.gcs.bucket` or `storage.azure.container` against the
   provider.
2. Check that the credentials can list the bucket. Widen the policy rather than weakening the
   probe.

### `not ready: spool: ...` [#not-ready-spool-]

```text
not ready: spool: open /tmp/dropshelf/.readyz-2881215967: permission denied
```

This happens when `server.spoolDir`, where uploads wait while they deploy, cannot take a file. The
end of the message is the system error, usually `permission denied` or
`no such file or directory`.

To fix it:

1. On the Compose stack, follow
   [`not ready: spool: ... permission denied` after a restart](#not-ready-spool--permission-denied-after-a-restart).
2. On Kubernetes, delete the pod. Its spool `emptyDir` is made afresh, and nothing in it has to
   survive.

### `not ready: shutting down` [#not-ready-shutting-down]

```text
not ready: shutting down
```

This happens when the pod received SIGTERM and is draining on purpose. There is nothing to fix: the
pod stops once its in-flight requests and deploys finish.

## `not ready: spool: ... permission denied` after a restart [#not-ready-spool--permission-denied-after-a-restart]

On the Compose stack, every deploy fails with 500 after the stack was stopped and started, or after
the host rebooted. Drops that are already live keep serving. `/readyz` answers:

```text
not ready: spool: open /tmp/dropshelf/.readyz-2881215967: permission denied
```

This happens because Docker remounts the spool `tmpfs` with mode 755 when it starts a container
again, so the server's user can no longer write to it.

To fix it:

1. Recreate the dropshelf container. A create sets the mount's mode again, and a start does not.

   ```bash
   make compose-recreate
   ```

   On the Dex stack, name the service:

   ```bash
   COMPOSE_PROFILES=dex COMPOSE_APP_SERVICE=dropshelf-dex make compose-recreate
   ```

2. Check that `/readyz` answers `ready`.

The recreate replaces only the dropshelf container. Postgres, the bucket and every drop are
untouched. If you started the stack on other ports, set the same `DROPSHELF_HOST_PORT` and
`DROPSHELF_METRICS_HOST_PORT` for the recreate.

<Callout type="warn">
Do not run `make compose-down` for this. It deletes the stack's Postgres and MinIO volumes, with the
database and every drop.
</Callout>

## Deploys fail with 500 and the log is empty [#deploys-fail-with-500-and-the-log-is-empty]

Every deploy answers 500, while the dashboard, the API reads and live drops keep working. The
container log has nothing about it, and `/readyz` may answer:

```text
not ready: spool: ...
```

This happens when the spool directory is full. A deploy stores its upload and the files it unpacks
there, and the chart's spool volume, 2 GiB, is sized for four concurrent 100 MiB deploys. Raising
`deploy.maxZipBytes`, `deploy.maxTotalBytes` or `deploy.maxConcurrentDeploys` changes that sum. A
spool with a few kilobytes left can still pass `/readyz`.

To fix it, do one of these:

- Raise the volume to fit your limits, in your values file, and run `helm upgrade`. The volume uses
  the node's ephemeral storage, so the node needs room for it.

  ```yaml
  volumes:
    spool:
      sizeLimit: 4Gi
  ```

  Raise `resources.requests.ephemeral-storage` by the same amount, since it is the sum of the spool
  and cache volumes.

- Lower `deploy.maxConcurrentDeploys`, which is per replica. Deploys beyond it get 503 with
  `Retry-After` instead of filling the spool.
- To recover now, delete the pod. Its spool is made afresh, and the server empties it at every
  startup anyway.

To confirm the fix, publish a real drop: `/readyz` alone does not prove the spool has room.

## `Deploy in progress` [#deploy-in-progress]

Every attempt to deploy one drop answers 409:

```text
Deploy in progress: Wait for the current deploy to finish.
```

This happens when a pod died during a deploy and the deploy still holds the drop's slot.

To fix it:

1. Wait about three minutes and try again. The reaper marks the deploy failed once its lease of
   `deploy.leaseTTL`, two minutes, has passed, at its next run.
2. If the 409 lasts much longer, check that `dropshelf_reaper_last_run_timestamp` advances on every
   pod, and whether `dropshelf_reaper_errors_total` rises.
3. Read the pods' logs for the failing reaper step, which the error names.

`GET /api/v1/deploys/<id>` then reports `status: "failed"` with the error
`deploy abandoned: the replica running it stopped renewing its lease`. A drop whose first deploy was
abandoned is deleted, which frees its name. A drop that was live keeps serving the version it had.

## `The plan expired before it was committed.` [#the-plan-expired-before-it-was-committed]

A version that a member's CLI or agent started from changed files fails with:

```text
The plan expired before it was committed.
```

This happens when a plan is not committed within ten minutes of being made, so the reaper closes it.
A plan holds no slot and blocks nothing.

To fix it:

1. Ask the member to push again.

## `object cache failed` [#object-cache-failed]

`dropshelf_cache_errors_total{cache="object"}` rises on a pod, and its log has lines with the message
`object cache failed`, an `op` and an `error`. Drops keep serving from the bucket, so bucket reads and
latency rise. Readiness stays green on purpose.

This happens when the cache directory, `cache.dir`, cannot hold the file. The `error` field names
the cause: `no space left on device`, `permission denied`, or a digest mismatch.

To fix it:

1. For a full volume, check the node's free space, since `dropshelf_cache_bytes` counts only indexed
   files. Keep `cache.maxBytes` at about 80 percent of `volumes.cache.sizeLimit`, and raise the two
   together.
2. For `permission denied`, check that the `cache` volume is mounted at `cache.dir` and that the
   volume honours the pod's `fsGroup`.
3. For a digest mismatch, compare the object in the bucket with the version's files. If the
   bucket's copy is wrong, publish the drop again.
4. To recover now, delete the pod. The cache needs no backup, and a new pod starts with an empty one.

## `cache dir: diskcache: cache failure:` [#cache-dir-diskcache-cache-failure]

The container exits at startup with a message such as:

```text
cache dir: diskcache: cache failure: create /var/cache/dropshelf/objects: mkdir /var/cache/dropshelf/objects: permission denied
```

This happens when the server cannot create, clear or write to `cache.dir`, which must be a writable
mount. The message can also name `clear`, or say the directory `is not writable`.

To fix it:

1. On the Compose stack, run `make compose-recreate`, for the same reason as the
   [spool permission error](#not-ready-spool--permission-denied-after-a-restart).
2. On Kubernetes, check that the `cache` volume is mounted at `cache.dir` and is separate from the
   spool directory and the `fs` storage root.

## `Live version moved on` [#live-version-moved-on]

A publish is refused with 409 `Live version moved on`. The toolbox's `publish` exits 4 with:

```text
v7 was published after this version was started; bring its changes in first
```

This happens when someone published another version after the draft was started, so publishing it
would silently replace their changes.

To fix it, either:

- Ask the draft's author to pull the published changes in and publish again.
- Or, when replacing what was published is a decision someone has made, publish anyway. Members use
  **Publish anyway** in the dashboard, or `dropshelf publish --force`. An operator runs:

  ```bash
  kubectl exec -n dropshelf deploy/dropshelf -- /dropshelf-server publish <drop> <version> --force
  ```

Rolling back to a version that was live before is never refused.

## `Query blocked` on a drop that calls an MCP server [#query-blocked-on-a-drop-that-calls-an-mcp-server]

A drop's page shows no data, and its call is refused with 403 and the code `blocked`. The drop's
**Settings** tab says why under **Data**.

This happens when an admin unticks the query's tool on the source, or the source stops allowing it.

To fix it, tick the tool again on the source's **Tools** tab, change the source's **Allow**
setting, or publish a version without the query.

A visitor whose own connection is missing gets `connect_required` instead, and one whose sign-in ran
out gets `reconnect_required`. They connect again on **Connections**.

## `the database at ... is at migration` [#the-database-at--is-at-migration]

A toolbox command exits 1 with:

```text
the database at <database-url> is at migration 1 and this binary expects 2: start the new server, or run: dropshelf-server migrate
```

This happens when the toolbox runs a newer release than the database's schema. The toolbox never
migrates.

To fix it:

1. Finish the upgrade, so the new server migrates the database, or run the migration yourself:

   ```bash
   kubectl exec -n dropshelf deploy/dropshelf -- /dropshelf-server migrate
   ```

   It prints `migrations applied` when it is done.
