File cache conflicts when running multiple Claude Code instances with git worktrees
Resolved 💬 2 comments Opened Jan 11, 2026 by scabana Closed Jan 11, 2026
Problem
When running multiple Claude Code instances in the same root repository but working in different git worktrees, the file cache appears to be shared at the project/folder level. This causes conflicts where:
- Instance A reads a file in worktree A
- Instance B reads a different file in worktree B
- Instance A tries to write/edit its file → "File has been unexpectedly modified" or "File has not been read yet"
Steps to Reproduce
- Create a git worktree:
git worktree add .worktree/issue-123 -b feature/issue-123 - Open Claude Code in the main folder, reference a file in
.worktree/issue-123 - Open another Claude Code instance in the main folder (or another worktree)
- Have both instances read files
- Try to edit a file in either instance → cache invalidation errors
Expected Behavior
Each Claude Code instance should maintain its own file cache, or the cache should be scoped per-worktree when working with git worktrees.
Current Workaround
- Pause other instances when editing files
- Launch Claude Code directly from within each worktree folder instead of from the parent
- Manually paste file content
Environment
- Windows (MINGW64)
- Multiple Claude Code instances running concurrently
- Using git worktrees for parallel development on different issues
Suggested Solution
Consider one of:
- Per-instance file cache (using session/process ID)
- Per-worktree cache isolation when files are in different worktrees
- A configuration option like
CLAUDE_CACHE_SCOPE=instanceor similar
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗