# Paperless-ngx consume directory setup

LLMS index: [llms.txt](/en/llms.txt)

---

Lead paragraph: Paperless-ngx refuses to ingest documents when the consume directory ownership or bind‑mount path is misconfigured. This note covers the exact steps to set up the consume folder, align UIDs with the container, and avoid the most common runtime errors.

## Prepare the directory and permissions

The consume directory is the host folder that Paperless‑ngx watches for new files. By default the container expects `/paperless/media`, but you can map any host path as long as ownership matches the process user inside the container (typically `1000` or the `paperless` system user).

Create the folder and set ownership in one step:

```bash
mkdir -p /srv/paperless-ngx/data/consume
chown -R 1000:1000 /srv/paperless-ngx/data/consume
```

If SELinux is enforcing, add the context `:z` or `:Z` to the bind mount (see the compose section). Without it, the container may fail to read files even with correct UIDs.

> [!TIP]
> Use `id -u` and `id -g` on the host to verify the numeric UID/GID you’re assigning. Consistency across restarts prevents silent failures.

> [!WARNING]
> Do not `chmod 777` the consume directory as a quick fix. Overly permissive modes mask the real ownership mismatch and create security gaps, especially if the host runs other services.

A quick check of the directory state:

```bash
ls -la /srv/paperless-ngx/data/consume/
# expected output starts with uid=1000 gid=1000
```

## Compose configuration and volumes

In a typical `docker-compose.yml` the consume folder is attached as a bind mount. The container path `/paperless/media` is the internal watch directory; files dropped into the host mount appear here instantly.

```yaml
services:
  paperless:
    image: ghcr.io/paperless-ngx/paperless-ngx:latest
    environment:
      - PAPERLESS_URL=https://paperless.example.com
      - PAPERLESS_SECRET_KEY=change-this-to-a-long-random-string
      - PAPERLESS_MEDIA_ROOT=/paperless/media
    volumes:
      - ./data/consume:/paperless/media:z
    # ports, restart, depends_on, db config omitted for brevity
```

The `:z` flag marks the mount as writable for the specific user inside a SELinux context. If your host is not SELinux‑aware, omit the flag or use `:Z` (which makes it writable for any user, less strict).

> [!NOTE]
> Paperless‑ngx creates subfolders inside `/paperless/media` automatically (e.g., `ingested`, `indexed`). Do not pre‑create them; the worker handles it.

If you run multiple Paperless instances on the same host, give each its own consume path and adjust the `PAPERLESS_MEDIA_ROOT` env var accordingly. Duplicate mounts will cause document ID conflicts.

## Document addition scenario

Once the bind mount is live, placing a file in the host consume folder triggers the internal watcher. The worker picks up the file, runs OCR (if not already done), and adds it to the database.

```bash
cp /home/user/scans/receipt.pdf /srv/paperless-ngx/data/consume/
```

Observe the process in the logs:

```bash
docker logs -f paperless | grep -i "consuming\|ocr\|indexing"
```

Typical timeline:
1. File appears in `/srv/paperless-ngx/data/consume/`
2. Worker detects new file within seconds (default poll interval ~5s, configurable via `PAPERLESS_WORKER_CONSUME_INTERVAL`)
3. OCR spawns (tesseract) if the file lacks a text layer
4. Document appears in the web UI under "Unfiled" or the target tag

You can also trigger consumption manually from the CLI inside the container:

```bash
docker exec -u 0 paperless paperless-ngx consume
```

This is useful for testing or after a bulk import. The command processes all files currently in the media directory and exits.

> [!WARNING]
> If you copy files faster than the worker processes them, you may see temporary "duplicate filename" errors. Paperless‑ngx deduplicates by content hash, but rapid bursts can fill the "unprocessed" queue. Batch import via the API or CLI is preferred for >50 files at once.

## Common errors and verification

| Error / Symptom | Likely Cause | Fix |
|-----------------|--------------|-----|
| `Permission denied` when worker reads a file | UID/GID mismatch on host mount | Re‑`chown` the host folder to the container user (`1000` or `paperless`) |
| Files appear but OCR never runs | Missing tesseract binary or wrong `PAPERLESS_OCR_LANGUAGE` | Install tesseract on the host or via the container’s `RUN apt-get update && apt-get install -y tesseract-ocr` and set the env var |
| `No such file or directory` in logs | Bind mount path incorrect or container restarted without the volume | Verify `docker ps` volume line and `docker compose down && docker compose up -d` |
| SELinux: read errors | Missing `:z` flag on bind mount | Add `:z` to the volume line in compose, or set `setsebool -P httpd_can_network_connect 1` if networking is involved |
| Document never shows in UI | Worker not running or `PAPERLESS_QUEUE_ENABLED=false` | `docker compose restart paperless` and check `docker compose logs paperless` for worker startup messages |

**Verification checklist after setup**

1. `ls -la /srv/paperless-ngx/data/consume/` shows `uid=1000` (or matching UID) and `drwxr-xr-x` permissions.
2. `docker compose ps` shows the Paperless container running with the volume mounted.
3. Place a test PDF, wait 10–15 seconds, then `docker exec paperless paperless-ngx document list | head -n 5` – the test doc should appear.
4. Check `docker logs paperless -n 30` for any `consume` or `OCR` messages without `error` or `traceback`.

If all four steps pass, the consume directory is correctly aligned with the container, and the pipeline from host‑drop to indexed document is operational.
