Agent worktree isolation fails on Windows due to case-insensitive path mismatch
Status Closed — duplicate
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 3 comments · opened Apr 8, 2026 · closed Apr 12, 2026
Bug Description
isolation: "worktree" in the Agent tool fails on Windows with:
Cannot create agent worktree: not in a git repository and no WorktreeCreate hooks are configured.
The repository is valid — git status, git worktree list, and git push all work correctly.
Root Cause
Case mismatch between shell working directory and git's reported toplevel:
$ pwd
/x/dev/growgeneration
$ git rev-parse --show-toplevel
X:/Dev/GrowGeneration
The Agent tool's git repository detection appears to do a case-sensitive path check, which fails on Windows (case-insensitive filesystem).
Environment
- OS: Windows 11 Home 10.0.26200
- Shell: Git Bash (MSYS2)
- Drive: X:\ (mapped/external drive)
- Claude Code version: Latest (auto-updates enabled)
- Model: claude-opus-4-6
Steps to Reproduce
- Open Claude Code on Windows in a git repository on a non-C: drive
- Use the Agent tool with
isolation: "worktree" - Observe the error despite being in a valid git repo
Expected Behavior
Git repository detection should use case-insensitive path comparison on Windows, or normalize paths before comparing.
Workaround
Set workflow.use_worktrees to false and run agents sequentially.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗