Sandbox/bwrap fails in git worktrees: Can't create file at .claude/commands

Resolved 💬 2 comments Opened Apr 18, 2026 by johannesjo Closed May 26, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When running claude with cwd inside a git worktree, every Bash tool call fails because bwrap tries to set up deny-overlay mounts on .claude/{settings.json,settings.local.json,commands,skills,agents} inside the cwd, but those paths don't exist in a fresh worktree.

Every Bash invocation dies with:

bwrap: Can't create file at /home/user/www/myproject/.worktrees/feat-x/.claude/commands: No such file or directory

Looking at mount from inside the sandbox confirms bwrap is attempting binds like:

/dev/nvme0n1p7 on .../.claude/settings.json type ext4 (ro,...)
udev on .../.claude/skills type devtmpfs (ro,...)
/dev/nvme0n1p7 on .../.claude/commands type ext4 (ro,...)
udev on .../.claude/agents type devtmpfs (ro,...)

These mount points don't exist in the worktree, so the mount fails, and because it aborts the entire sandbox setup, no Bash calls work at all.

What Should Happen?

Either (a) Claude creates the mount targets on launch if missing, (b) skips deny-mounts for paths that don't exist, or (c) resolves the .claude/ deny paths against the project's git common-dir (so they point at the main checkout), not the worktree cwd.

Bash tool calls should work normally when launched from inside a git worktree.

Error Messages/Logs

bwrap: Can't create file at /home/user/www/myproject/.worktrees/feat-x/.claude/commands: No such file or directory

Steps to Reproduce

  1. Have a project at ~/www/myproject/ with a populated .claude/ directory (agents, skills, commands, settings.json).
  2. Create a worktree: git worktree add .worktrees/feat-x feat/x
  3. Launch Claude from that worktree path: cd .worktrees/feat-x && claude
  4. Ask Claude to run any shell command.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.114

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

Environment:

  • bubblewrap: 0.9.0
  • OS: Ubuntu 24.04, kernel 6.17.0-20-generic
  • Shell: zsh

Workaround:
Pre-create the structure in the worktree before launching Claude:

mkdir -p .claude/{commands,skills,agents}
touch .claude/settings.json .claude/settings.local.json

Impact:
Git worktrees are the natural workflow for reviewing PRs or running parallel tasks, and this makes Claude unusable in that flow without a manual pre-step.

View original on GitHub ↗

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