Folder Renaming
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Title: Cannot rename working directory folder — Claude Code crashes with "Working directory no longer exists"
Issue:
When the folder that Claude Code is opened in is renamed, Claude Code throws a hard crash:
Working directory no longer exists: D:\Google Drive\0.000 Claude Code\Option Scanner by Claude.
The folder may have been moved, deleted, or unmounted.
There is no way to recover the session — it is permanently terminated.
Steps to reproduce:
- Open Claude Code desktop app (Windows 11), working directory:
D:\Google Drive\0.000 Claude Code\Option Scanner by Claude
- Rename the folder in Windows Explorer to a new name (e.g., OptionRadar)
- Claude Code immediately crashes with the error above — session is lost
Expected behavior:
Claude Code should either (a) detect the rename and update its working directory
reference, or (b) prompt the user to point to the new location and resume the session.
Actual behavior:
Hard crash, full session loss. Opening a new claude session in the renamed folder
starts a completely blank session with no prior context.
Environment:
- OS: Windows 11 Home 10.0.26200
- Claude Code: Desktop app
- Working directory: Google Drive synced folder on D:\
Request:
Support folder renames gracefully — either follow the rename (Windows provides rename
notifications via ReadDirectoryChangesW) or offer a session-reconnect dialog instead
of a hard crash.
What Should Happen?
Support folder renames gracefully — either follow the rename (Windows provides rename
notifications via ReadDirectoryChangesW) or offer a session-reconnect dialog instead
of a hard crash.
Error Messages/Logs
Steps to Reproduce
Steps to reproduce:
- Open Claude Code desktop app (Windows 11), working directory:
D:\Google Drive\0.000 Claude Code\Option Scanner by Claude
- Rename the folder in Windows Explorer to a new name (e.g., OptionRadar)
- Claude Code immediately crashes with the error above — session is lost
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.92 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
5 Comments
It happens on Mac too
Description
When a project folder is renamed or moved, the desktop app shows:
There is no way to recover from this screen without either renaming the folder back or creating a symlink at the old path.
Steps to reproduce
Expected behavior
The app should offer a folder picker to repoint the session to the new location, similar to how most IDEs handle this (VS Code, Xcode, etc.).
Actual behavior
Dead-end error screen. The "Open folder" button (if present) does not help — it repeats the same error.
Workaround
Create a symlink at the old path:
ln -s /new/path /old/pathPlatform
Same experience on macOS with a Google-Drive-synced folder — renaming it orphans every existing desktop-app chat in that folder ("Session not found on disk"), and the only reliable recovery I've found is renaming the folder back. I now avoid renaming or moving project folders entirely, which means stale names and folder bloat over time. +1 for making sessions survive a rename.
Confirming this reproduces on Linux (Ubuntu 22.04) with the VS Code extension as well — not just Windows/Desktop — so it looks like core path-handling behavior rather than a desktop-app-only issue.
Repro:
/home/user/projects/myproject.mvit), e.g. tomyproject-old.``
``Error: Claude Code returned an error result: Path "/home/user/projects/myproject" does not exist
View output logs · Troubleshooting resources
VS Code extension version
2.1.214. The working directory appears to be pinned as a path string and hard-checked for existence each turn, so any rename/move breaks the session until the original name is restored. The project's memory/history (also keyed to the encoded path under~/.claude/projects/<encoded-path>/) is likewise orphaned when reopening at the new path.\#79215 describes the ideal fix (sessions following a renamed/moved folder / persistent project identity).
You shouldn't need to rename the folder back permanently if the transcript files are still under
~/.claude/projects/. I've repaired this same path split by changing the stored project path rather than moving or rebuilding the session.Check one affected session first. Find its transcript file under
~/.claude/projects/<project-slug>/, then open the matching metadata file under~/Library/Application Support/Claude/claude-code-sessions/and inspect itscwd. If that still names the old folder, the conversation history is intact and the metadata is simply pointing at a path that no longer exists.I built
rewrite_metadata_cwd.pyinBasedGPT/claude-code-session-recoveryfor this case. Rundiagnose.pyfrom the same toolkit first; it maps the metadata and transcript files and gives you a diagnosis ID. Thenrewrite_metadata_cwd.pycan replace the old path with the new one in dry-run mode so you can review every proposed change before using--apply. Quit Claude Desktop fully before applying it, since the app can write its in-memory metadata back over an external edit.This addresses the stored file path after a move. It won't make the app follow future folder renames automatically, but it should remove the dead-end screen without leaving a permanent symlink behind.
Hope this helps, if my tools are able to help you, would appreciate a ⭐ :)