claude-code - 💡(How to fix) Fix [BUG] Claude Opus 4.8 makes changes outside the current worktree for the current session

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…

Error Message

Error Messages/Logs

Code Example

Reply from Claude: You're right — my edits were landing in the main repo (/myApp/app/...), not this worktree (.../.claude/worktrees/silly-austin-4ced74/app/...). The Explore agents reported main-repo paths and I followed them blindly. Let me undo the stray file in main and redo everything in the worktree.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

When using worktree mode with Claude Opus 4.8 in Claude Code MacOS desktop app (latest version - Claude 1.9659.2 (390d6c) 2026-05-28T21:50:01.000Z) it starts making changes outside the current worktree e.g. it tries to make changes in default worktree where default/primary branch is checked-out.

What Should Happen?

Claude should make changes in current worktree only

Error Messages/Logs

Reply from Claude: You're right — my edits were landing in the main repo (/myApp/app/...), not this worktree (.../.claude/worktrees/silly-austin-4ced74/app/...). The Explore agents reported main-repo paths and I followed them blindly. Let me undo the stray file in main and redo everything in the worktree.

Steps to Reproduce

  1. Start a session with worktree option checked/selected.
  2. Use plan mode to create a plan.
  3. Accept plan. <-- its very likely that the plan mode is confusing claude with paths that refer to main repo not current worktree
  4. Claude starts making changes in main repo outside current worktree.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

Claude 1.9659.2 (390d6c) 2026-05-28T21:50:01.000Z

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

N/A

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 Opus 4.8 makes changes outside the current worktree for the current session