anthropics / anthropics/claude-code
[BUG] Assigned working folder stays locked by background process after closing chat, blocking deletion (Windows)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 147k
- Forks
- 24k
- PR merge metrics
- PR metrics pending
Description
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 a local folder is assigned as the working directory for a Claude Code Desktop chat/session on Windows, the folder remains locked by a background process even after the chat window is closed. Windows Explorer refuses to delete the folder, reporting that another process is still using it.
The lock is only released once the folder assignment is explicitly removed from the chat, or the associated session/task is deleted in the app.
What Should Happen?
After closing the chat window, the assigned folder should no longer be held open by a background process (or the app should clearly indicate the session is still running in the background and holding a handle on the folder). The folder should be deletable in Windows Explorer right after the window is closed.
Error Messages/Logs
Windows Explorer error when attempting to delete the folder: "The action can't be completed because the folder or a file in it is open in another program." (Windows was set to German; message paraphrased/translated.)
Steps to Reproduce
- Open the Claude Code Desktop app on Windows and start a new chat.
- Assign a local folder (e.g. a subfolder under Downloads) as the working directory for the chat.
- Let Claude Code perform file operations in that folder (e.g. sorting/moving files).
- Close the chat window WITHOUT explicitly deleting the session/task or removing the folder assignment first.
- Try to delete the folder in Windows Explorer.
Expected: the folder deletes normally.
Actual: Windows reports the folder is in use by another process. Explicitly deleting the chat/task (or removing the folder assignment) in the app releases the lock and allows deletion.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2.2553.1 (Claude Code Desktop app)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Suspected cause: a background process (Node/Electron) tied to the session keeps an open file handle on the assigned working directory for as long as the session/task exists, independent of whether the chat window itself is open or closed. Only deleting the session/task (or unassigning the folder) terminates that process and releases the handle.
Environment: Windows 11 Pro, build 10.0.26200.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue on Windows 11 using the Desktop app, an assigned working folder, and the close-chat sequence described. Trace the Desktop session/task lifecycle and working-directory assignment, focusing on cleanup after the chat window closes. Done means the folder can be deleted immediately after closing the chat, without requiring session deletion or unassignment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, node.js, powershell, typescript
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100