Skip to content

[Bug]: Unable to open database file #467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 of 4 tasks
alexgutjahr opened this issue Apr 12, 2025 · 0 comments
Open
3 of 4 tasks

[Bug]: Unable to open database file #467

alexgutjahr opened this issue Apr 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@alexgutjahr
Copy link

🔍 Bug Summary

Application fails to start because it cannot open the database file

📖 Description

I've tried running the application through docker compose, but it fails with the error below.

2025-04-12T10:20:35: PM2 log: App [paperless-ai:0] starting in -cluster mode-
2025-04-12T10:20:35: PM2 log: App [paperless-ai:0] online
Loading .env from: /app/data/.env
Loaded environment variables: {
  PAPERLESS_API_URL: undefined,
  PAPERLESS_API_TOKEN: '******',
  LIMIT_FUNCTIONS: {
    activateTagging: 'yes',
    activateCorrespondents: 'yes',
    activateDocumentType: 'yes',
    activateTitle: 'yes',
    activateCustomFields: 'yes'
  }
}
SqliteError: unable to open database file
    at new Database (/app/node_modules/better-sqlite3/lib/database.js:69:26)
    at Object.<anonymous> (/app/models/document.js:14:12)
    at Module._compile (node:internal/modules/cjs/loader:1554:14)
    at Object..js (node:internal/modules/cjs/loader:1706:10)
    at Module.load (node:internal/modules/cjs/loader:1289:32)
    at Function._load (node:internal/modules/cjs/loader:1108:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
    at Module.<anonymous> (node:internal/modules/cjs/loader:1311:12)
    at Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39)
2025-04-12T10:20:36: PM2 log: App name:paperless-ai id:0 disconnected
2025-04-12T10:20:36: PM2 log: App [paperless-ai:0] exited with code [0] via signal [SIGINT]
2025-04-12T10:20:36: PM2 log: App [paperless-ai:0] will restart in 5743ms
2025-04-12T10:20:37: PM2 log: 0 application online, retry = 3
2025-04-12T10:20:39: PM2 log: 0 application online, retry = 2
2025-04-12T10:20:41: PM2 log: 0 application online, retry = 1

.. for reference, here is the compose file I am using:

---
services:
  paperless-ai:
    image: clusterzx/paperless-ai
    container_name: paperless-ai
    restart: unless-stopped
    networks:
      - homelab
    cap_drop:
      - ALL
    security_opt:
      - no-new-privileges=true
    environment:
      - PUID=1000
      - PGID=1000
      - PAPERLESS_AI_PORT=3000
    volumes:
      - /home/docker/paperless-ai/data:/app/data
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.paperless-ai.rule=Host(`paperless-ai.example.org`)"
      - "traefik.http.routers.paperless-ai.entrypoints=websecure"
      - "traefik.http.routers.paperless-ai.tls=true"
      - "traefik.http.routers.paperless-ai.tls.certresolver=cloudflare"
      - "traefik.http.services.paperless-ai.loadbalancer.server.port=3000"

networks:
  homelab:
    external: true

I thought that maybe it is an error with permissions on the volume, but when I connect to the container with 1000:1000 I can create files in the /app/data directory as I would expect. The volume on the docker host is also owned by 1000:1000.

🔄 Steps to Reproduce

Run the provided docker compose file.

✅ Expected Behavior

Application successfully starts.

❌ Actual Behavior

Application fails to start.

📜 Docker Logs

n/a

📜 Paperless-ngx Logs

not relevant

🖼️ Screenshots of your settings page

No response

🖥️ Desktop Environment

Other

💻 OS Version

Linux iron 6.11.0-14-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 10 23:48:25 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

🌐 Browser

None

🔢 Browser Version

No response

🌐 Mobile Browser

No response

📝 Additional Information

  • I have checked existing issues and this is not a duplicate
  • I am sure that this problem is affecting everyone, not only me
  • I have tried debugging this issue on my own
  • I can provide a fix and submit a PR

📌 Extra Notes

I don't know how I could be sure that this problem is affecting everyone - most likely I made a mistake somewhere in the setup and if the issue would affect everyone I would probably have found an existing issue for it by now.

@alexgutjahr alexgutjahr added the bug Something isn't working label Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant