Folder Renaming

Status Fixed / completed
Reported on v2.1.92
Maintainer reply None cached
Activity 5 comments · opened May 14, 2026 · closed Aug 25, 2026

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:

  1. Open Claude Code desktop app (Windows 11), working directory:

D:\Google Drive\0.000 Claude Code\Option Scanner by Claude

  1. Rename the folder in Windows Explorer to a new name (e.g., OptionRadar)
  2. 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:

  1. Open Claude Code desktop app (Windows 11), working directory:

D:\Google Drive\0.000 Claude Code\Option Scanner by Claude

  1. Rename the folder in Windows Explorer to a new name (e.g., OptionRadar)
  2. 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_

View original on GitHub ↗

5 Comments

arturogarrido · 2 months ago

It happens on Mac too

arturogarrido · 2 months ago

Description

When a project folder is renamed or moved, the desktop app shows:

"Working directory no longer exists: /old/path. The folder may have been moved, deleted, or unmounted."

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

  1. Open a project in the Claude Code desktop app
  2. Rename or move the project folder in Finder/Explorer
  3. Return to the desktop app

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/path

Platform

  • macOS 15.x
  • Claude Code desktop app
geokao · 1 month ago

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.

SanjidMzi · 1 month ago

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:

  1. Open Claude Code in a folder, e.g. /home/user/projects/myproject.
  2. Rename that folder (via the shell, the OS file manager, or by asking Claude to mv it), e.g. to myproject-old.
  3. The session immediately fails with:

``
Error: Claude Code returned an error result: Path "/home/user/projects/myproject" does not exist
View output logs · Troubleshooting resources
``

  1. Renaming the folder back to the original name restores the session.

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).

BasedGPT · 1 month ago

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 its cwd. 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.py in BasedGPT/claude-code-session-recovery for this case. Run diagnose.py from the same toolkit first; it maps the metadata and transcript files and gives you a diagnosis ID. Then rewrite_metadata_cwd.py can 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 ⭐ :)