[BUG] Tool dies, unable to open the SQLite DB, when run inside a Docker container

Resolved 💬 2 comments Opened May 2, 2025 by ianchesal Closed May 2, 2025

Environment

  • Platform (select one):
  • [X] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.99
  • Operating System: Debian 12.10
  • Terminal: Kitty

Bug Description

Note: I am running Claude CLI in a Debian Docker container. This has been a problem since the 0.2.91 release. It's not a problem up to 0.2.90.

I really just need to know where on the image it's trying to create the SQLite DB so I can adjust the container settings to make that path writeable by the user in the container.

Steps to Reproduce

  1. Build Claude in to a container using this Dockerfile and the command docker build --no-cache -t claude-code -f claude-code/Dockerfile claude-code
  2. Make sure you have a ~/.config/claude/claude.json file. It can be empty.
  3. Run the container against in any source code repo directory with: docker run -it --rm -v ${HOME}/.config/claude/claude.json:/home/codeuser/.claude.json:rw -v $(pwd):/app:rw claude-code
  4. Ask the tool: what rules are you following?

Expected Behavior

It prints out the rules it is following.

Actual Behavior

It dies complaining that it cannot open the SQLite DB:

Failed to open conversation storage. Attempting to repair.
This may take a moment.
Dependency successfully repaired.
SqliteError: unable to open database file
    at new Database (/home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/node_modules/better-sqlite3/lib/database.js:69:26)
    at xh0 (file:///home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:532:25079)
    at file:///home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:532:25709
    at D (file:///home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:505:12907)
    at dh0 (file:///home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:532:26711)
    at m51 (file:///home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:549:885)
    at file:///home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2028:1982
    at KG (file:///home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:93:21373)
    at $B (file:///home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:93:40823)
    at aV (file:///home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:93:34912) {
  code: 'SQLITE_CANTOPEN'
}

  ERROR  unable to open database file

 /home/codeuser/.npm-global/lib/node_modules/@anthropic-ai/claude-code/node_modules/better-sqlite3/lib/database.js:69:26

 66:   }
 67:
 68:   Object.defineProperties(this, {
 69:     [util.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly, fileMustExist, timeout, verbose || null, buffer || null) },
 70:     ...wrappers.getters,
 71:   });
 72: }

Additional Context

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗