Skip to content

[BUG] CRITICAL ISSUE BRIEF: Workspace Corruption & Session Bleed #28801

Closed as not planned

Description

@azharmateen

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?

The Incident
While using Claude Code v2.1.50 across multiple terminal windows, a command to "restart application" resulted in the immediate disappearance or "emptying" of the project directory. The project files were later discovered at a different absolute path, while the original working directory was reduced to empty "stubs."

What Should Happen?

Potential Root Cause: Multi-Instance Session Bleed
The user was operating three simultaneous terminal windows, each running a separate project. It was observed that:

Command Leakage: Prompts/history entered in Project A’s terminal appeared in Project B’s terminal.

State Collision: The CLI tool appears to use a shared global state or cache (~/.claude/ or similar).

Faulty Path Resolution: When a "restart" or rm command is issued in a multi-instance environment, the tool may lose track of which PID (Process ID) is associated with which absolute path, leading it to execute destructive commands (like clearing a build cache) on the wrong directory or a temporary worktree.

Symptoms to Watch For
Shared History: If you see a prompt you typed in one window appearing in the history (Ctrl+O) of another window.

Path Confusion: Claude starts referencing files in /Users/apple/projects/www/... when you are clearly working in /Users/apple/projects/applications/....

Sudden "No Source Found": After a build or restart command, Claude claims it "couldn't find any app directory" despite you being inside it.

Interim Mitigation for the Community
Avoid Parallel Sessions: Until a fix is issued, try to run only one active Claude Code session at a time for "heavy" operations (restarts, builds, or file deletions).

Check pwd Frequently: If Claude seems confused, verify the path using the pwd tool before allowing it to run any rm or reset commands.

Git is Mandatory: Do not run Claude Code on uncommitted code. If the session bleeds and triggers a reset, your uncommitted work may be lost or moved to an obscure path.

Error Messages/Logs

Steps to Reproduce

Try to work on multiple projects by switching the projects from within the Claude Code CLI, like focus /apple/projects/ .... and then do some work, and after that say "restart application".

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

v2.1.50

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

Activity

  1. github-actions commented on Feb 26, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] v1.1.3963 regression: multiple sessions in same cwd cross-contaminate prompt routing Version: 1.1.3963 (regressed from 1.1.3918 which worked correctly) #27666
    2. Desktop app broadcasts single prompt to multiple sessions simultaneously #27470
    3. JSONL cross-session contamination: all event types written to wrong session file when multiple sessions are active #26964

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. mantrahq502 commented on Feb 26, 2026

    @mantrahq502

    Session bleed — where one session's context contaminates another — is particularly hard to debug because it's invisible during the session itself and only shows up as unexpected behavior downstream.

    The structural issue is that Claude Code doesn't maintain strict session isolation at the JSONL level when multiple sessions share an overlapping workspace context. Without hard session boundaries anchored to git state, bleed is essentially a race condition.

    Mantra (mantra.gonewx.com) helped me get visibility into this: it anchors each session to a specific git commit, so when I see unexpected context in a session, I can use the session timeline to trace exactly which prior session state could have bled in. It's not a fix for the underlying isolation bug, but it gives you forensic capability to identify and isolate the bleed source.

  3. azharmateen commented on Feb 26, 2026

    @azharmateen
    Author

    The issue is not that multiple sessions are open and one session interferes with another. The real problem is that the entire project folder gets moved to a different location due to confusion in the workspace path—even when it is not in the same directory as the other session.

    For example:

    /User/apple/projects/applications/projects/project.1, project.2, project.3 … project.30

    All of these projects were suddenly moved to an unknown location. After searching, I discovered they had been relocated to:

    /User/apple/www/gift/project/...

    There was no warning and no indication that this was happening. Thankfully, the projects were not deleted—only moved.

  4. github-actions commented on Mar 26, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  5. github-actions commented on Apr 5, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  6. locked as resolved and limited conversation to collaborators on Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdata-lossplatform:macosIssue specifically occurs on macOSstaleIssue is inactive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions