claude-code - 💡(How to fix) Fix [Bug] Claude reads from main repo path instead of git worktree when memory namespace matches main repo [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48096Fetched 2026-04-15 06:33:20
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1

Fix Action

Fix / Workaround

Workaround: User must explicitly correct Claude; it then works correctly for the rest of the session.

Code Example

<i scrubbed this manually since there was no relevant content here>
RAW_BUFFERClick to expand / collapse

Bug Description Claude reads from main repo path instead of git worktree when memory namespace matches main repo

When Claude Code is launched from a git worktree (e.g. ~/code/starburst-enterprise/tmp-cli), the session's Primary working directory correctly reflects the worktree path. However, the memory namespace is named after the main repo root (e.g. -starburst-enterprise), and Claude incorrectly uses the memory namespace path to infer file locations rather than the Primary working directory from the session context.

Steps to reproduce:

  1. Have a git repo at ~/repos/main-repo
  2. Create a worktree at ~/repos/main-repo-worktree
  3. Launch claude from within the worktree
  4. Ask Claude to read a file — it attempts to read from ~/repos/main-repo instead

Expected: Claude uses Primary working directory (the worktree path) for all file operations.

Actual: Claude uses the memory directory name (derived from the main repo path) to construct file paths.

Workaround: User must explicitly correct Claude; it then works correctly for the rest of the session.

Environment Info

  • Platform: darwin
  • Terminal: tmux
  • Version: 2.1.92
  • Feedback ID: 816e00ab-5100-444e-8b51-78af20b0bba2

Errors

<i scrubbed this manually since there was no relevant content here>

Note: Content was truncated.

extent analysis

TL;DR

Claude may need a configuration change or code update to correctly use the Primary working directory from the session context instead of the memory namespace path when launched from a git worktree.

Guidance

  • Verify that the Primary working directory is correctly set to the worktree path in the session context when launching Claude from a git worktree.
  • Check if there's a configuration option to override the memory namespace path with the Primary working directory.
  • Investigate the code that constructs file paths in Claude to see if it can be updated to use the Primary working directory instead of the memory namespace path.
  • Consider adding a temporary workaround to explicitly correct Claude's file path construction until a permanent fix is implemented.

Example

No code snippet is provided as the issue does not contain sufficient information about the codebase.

Notes

The issue seems to be related to how Claude handles git worktrees and memory namespaces. Without more information about the code or configuration, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: Until a permanent fix is implemented, users can explicitly correct Claude's file path construction to use the correct worktree path, as mentioned in the issue description. This will allow Claude to function correctly for the rest of the session.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Claude reads from main repo path instead of git worktree when memory namespace matches main repo [1 comments, 2 participants]