claude-code - 💡(How to fix) Fix [BUG] Claude Code chat session lost when opening a folder in VS Code [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

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#49082Fetched 2026-04-17 08:51:24
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Timeline (top)
labeled ×4commented ×2

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?

Description: I started a new project in VS Code with Claude Code. Since it was a fresh start, no files or folders were open in the workspace yet. After an ongoing conversation where we were planning and building the project, the project folder was already created on my local drive. I simply opened that folder in the same VS Code window while the chat was still in progress. The moment I opened the folder, the entire Claude Code chat disappeared — no history, no way to recover it. The conversation was completely gone.

What Should Happen?

What Should Happen?

The chat session should persist when opening a folder in the same VS Code window If the session must restart due to workspace change, there should be a warning before the conversation is lost Conversation history should be recoverable — either through auto-save or a session restore option

Error Messages/Logs

Steps to Reproduce

  1. Open VS Code with no folder/workspace open
  2. Start a Claude Code conversation (plan a project, generate files, etc.)
  3. Once the project folder exists on your local drive, open it via File → Open Folder in the same VS Code window
  4. Claude Code chat disappears — session and conversation history are gone

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.110 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

No response

extent analysis

TL;DR

The issue can be mitigated by warning users before opening a new folder in the same VS Code window, potentially preserving the Claude Code chat session.

Guidance

  • Investigate the current implementation of handling workspace changes in VS Code to understand why the Claude Code chat session is lost when opening a new folder.
  • Consider adding a warning prompt before opening a new folder, allowing users to save or recover their conversation history.
  • Review the auto-save or session restore functionality to determine if it can be integrated with the Claude Code chat to prevent loss of conversation history.
  • Examine the differences between the current version (2.1.110) and the previous working version to identify potential regression causes.

Example

No code example is provided as the issue does not contain sufficient technical details to generate a relevant snippet.

Notes

The provided information suggests a regression issue, but without knowing the last working version, it's challenging to pinpoint the exact cause. The mitigation steps focus on preserving user conversation history and improving the user experience when handling workspace changes.

Recommendation

Apply workaround: Implement a warning prompt before opening a new folder in the same VS Code window to alert users about potential loss of conversation history, allowing them to take necessary actions to preserve their chat 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