Where on the filesystem is it trying to create the sqlite database?

Status Fixed / completed
Maintainer reply ✓ Yes — wolffiex
Activity 10 comments · opened May 6, 2025 · closed May 7, 2025
💡 Likely answer: A maintainer (wolffiex, collaborator) responded on this thread — see the highlighted reply below.

For running containered, I'd like to know were on the filesystem the CLI is trying to create the database so I can ensure it's mapped in as a bind mount, persisted between sessions, and has the correct permissions inside the container to read and write the database.

This is what I'm seeing:

codeuser@8419d2b29ca8:/app$ claude --resume
Database is not available. Continue/resume features are disabled.
This is likely due to issues with the better-sqlite3 dependency.
To fix: Try globally reinstalling better-sqlite3 with your package manager.
For more detail, see: https://github.com/WiseLibs/better-sqlite3/blob/master/docs/troubleshooting.md

And I'm fairly confident it's just a read/write issue on whatever path the CLI is trying to use for this database I need to sort out in my container.

View original on GitHub ↗

10 Comments

abraithwaite · 1 year ago

I'm continuing to get this also. I'm using just the nodejs provided by homebrew.

I noticed that whenever Claude code auto-updates, it's wiping out whatever existing dependency cache was there.

Workaround for me is now:

cd /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/node_modules/better-sqlite3
npm run build-release

And that fixes it. Having to do it every auto-update by Claude is very annoying though.

Related issues: https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aclosed%20sqlite

askibinski · 1 year ago

Got the same issue as @ianchesal on linux, having both claude and better-sqlite3 installed globally. Verified that sqlite works in the project dir, and claude says npm permissions are OK. But the warning persists and I also think it a read/write permission issue but not sure howto fix it.

This warning suddenly popped up after the latest auto-update it seems.

ianchesal · 1 year ago

Ahh well. If it's happening outside of a container for @abraithwaite and @askibinski maybe it's an actual bug and not me being paranoid and jailing stuff in a container?

My container setup for repro is here: https://github.com/ianchesal/agent-containers/tree/main/claude-code

ianchesal · 1 year ago
Workaround for me is now: `` cd /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/node_modules/better-sqlite3 npm run build-release `` And that fixes it.

This doesn't help for me. The module builds correctly inside my container, but I still get the DB missing error when starting claude.

I appreciate the tip though!

wolffiex collaborator · 1 year ago

happy to help with this @ianchesal
the db is currently stored in ~/.claude/__store.db and this location and not configurable
for the next release I can update this so it respects $CLAUDE_CONFIG_DIR

wolffiex collaborator · 1 year ago

As of 0.2.103 the __store.db file containing the database will respect the $CLAUDE_CONFIG_DIR setting

ianchesal · 1 year ago

@wolffiex thank you! That was exactly what I needed to fix my problem. Mounting ~/.claude in to my container rw stopped the database error from occurring.

Any chance, with ~/.claude growing in use, that you'll re-home ~/.claude.json to ~/.claude/claude.json so the configuration file, the global rule file ~/.claude/CLAUUDE.md and all the other generated files are all in one sub-directory?

For the curious, my launch call for my container is now:

function __ai_container_launcher() {
  if type podman >/dev/null; then
    LAUNCHER="podman run --userns=keep-id"
  else
    LAUNCHER="docker run"
  fi
  echo $LAUNCHER
}

function claude() {
  eval "$(__ai_container_launcher) --tty --interactive -v ${HOME}/.config/claude/claude.json:/home/codeuser/.claude.json:rw \
    -v ${HOME}/.config/claude:/home/codeuser/.claude:rw \
    -v $(pwd):/app:rw \
    claude-code $@"
}
wolffiex collaborator · 1 year ago

Yes, we are headed in the direction of having everything inside ~/.claude Glad this helped!

ianchesal · 1 year ago

Amazing. As a (very) long time vim user, working with Claude at the command line has been the best way to add AI to my coding workflow yet.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.