claude-code - 💡(How to fix) Fix [BUG] session created in the wrong place

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

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 creating a new session and choosing a directory unrelated to the current project, Claude Code rooted the session in an existing worktree and added the chosen directory as secondary instead of starting fresh."

What Should Happen?

it should open my new session inside the folder I select. (note, I'm using the new claude code desktop, not the terminal version)

Error Messages/Logs

Steps to Reproduce

  1. Have an existing project with worktrees
  2. click New Session
  3. Select a folder outside the existing project
  4. See that it puts that new folder into the git subtree and makes it part of the existing session for that overall project

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.111

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

No response

extent analysis

TL;DR

The issue can be mitigated by ensuring that the selected directory is not inadvertently linked to an existing project worktree, potentially by modifying the New Session workflow.

Guidance

  • Verify that the selected directory is not a subdirectory of an existing project to prevent it from being added as a secondary directory to the existing worktree.
  • Check the project settings to see if there's an option to start a new session in a completely isolated environment, disconnected from existing projects.
  • Consider testing the New Session feature with a directory that has no relation to any existing project or worktree to isolate the issue.
  • If the issue persists, try creating a new project from scratch and then attempt to create a new session to see if the behavior changes.

Example

No code snippet is provided as the issue seems related to the application's workflow and project management rather than a specific code error.

Notes

The exact cause of the issue is unclear without more detailed logs or error messages. The steps to reproduce are well-defined, which should help in isolating the problem.

Recommendation

Apply workaround: The best course of action seems to be to carefully manage project directories and worktrees to avoid unintended links between new sessions and existing projects, until a more direct fix or clarification on the intended behavior is provided.

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] session created in the wrong place