claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] creates `tmpclaude-*-cwd` files in the current working directory

Open seeper0 opened this issue 10 months ago • 64 comments

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?

Claude Code 2.1.5 creates tmpclaude-*-cwd files in the current working directory instead of /tmp. These files are never cleaned up and accumulate in project directories.

What Should Happen?

This appears to be a regression from the original issue #8856, where files were created in /tmp/claude-*-cwd. Now they are created directly in the working directory with a different naming pattern (tmpclaude-*-cwd).

Error Messages/Logs


Steps to Reproduce

  1. Start Claude Code in a project directory
  2. Execute several bash commands
  3. Check the working directory for tmpclaude-*-cwd files

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.5

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

No response

seeper0 avatar Jan 12 '26 03:01 seeper0

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/17589
  2. https://github.com/anthropics/claude-code/issues/17568

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

github-actions[bot] avatar Jan 12 '26 03:01 github-actions[bot]

Additional reproduction data:

  • Claude Code version: 2.1.5
  • OS: Windows 11
  • Shell: Git Bash
  • Files accumulated: 119 tmpclaude-*-cwd files
  • Time period: Single session (~2.5 hours)
  • Location: Project working directory (not %TEMP%)
  • File contents: Unix-style path (e.g., /d/repos/organization/pot/pineapple)

Timestamps show files created throughout the session (19:08-21:31) correlating with Bash tool invocations. Files persist after session ends.

This appears to be the same root cause as #8856 (missing unlinkSync after reading the temp file), with the Windows variant incorrectly placing files in CWD instead of the system temp directory.

misterpalmer avatar Jan 12 '26 05:01 misterpalmer

https://github.com/anthropics/claude-code/issues/17568#issuecomment-3736945382

Haleclipse avatar Jan 12 '26 05:01 Haleclipse

Image even a empty directory will creat these rubish

iverson333333 avatar Jan 12 '26 17:01 iverson333333

I am also experiencing this

Image

domNocrus avatar Jan 12 '26 17:01 domNocrus

I am also experiencing same really annoying

mudassar003 avatar Jan 12 '26 18:01 mudassar003

yes, same issue.

wheeler88 avatar Jan 12 '26 18:01 wheeler88

Same issue here

jrolh avatar Jan 12 '26 19:01 jrolh

+1

cailleachzou avatar Jan 12 '26 19:01 cailleachzou

+1

sriram-rach avatar Jan 12 '26 21:01 sriram-rach

+1

literallytwo avatar Jan 12 '26 21:01 literallytwo

+1

calvincronin avatar Jan 12 '26 21:01 calvincronin

+1

LavelleUp avatar Jan 12 '26 21:01 LavelleUp

+1

PS C:\Users\USER\DIR_FHE> ls .\tmpclaude-*-cwd ; git status -s

Directory: C:\Users\USER\DIR_FHE

Mode LastWriteTime Length Name


-a---- 2026-01-12 14:22 30 tmpclaude-020b-cwd -a---- 2026-01-12 14:22 30 tmpclaude-06ae-cwd -a---- 2026-01-12 15:20 30 tmpclaude-0903-cwd -a---- 2026-01-12 14:43 30 tmpclaude-0d70-cwd -a---- 2026-01-12 14:35 30 tmpclaude-149c-cwd -a---- 2026-01-12 14:44 30 tmpclaude-25d9-cwd -a---- 2026-01-12 15:57 30 tmpclaude-2630-cwd -a---- 2026-01-12 14:33 30 tmpclaude-2787-cwd -a---- 2026-01-12 15:31 30 tmpclaude-324f-cwd -a---- 2026-01-12 14:33 30 tmpclaude-32b3-cwd -a---- 2026-01-12 14:43 30 tmpclaude-41fa-cwd -a---- 2026-01-12 15:31 30 tmpclaude-4e36-cwd -a---- 2026-01-12 14:41 30 tmpclaude-69e6-cwd -a---- 2026-01-12 14:31 30 tmpclaude-6cf5-cwd -a---- 2026-01-12 14:26 30 tmpclaude-779d-cwd -a---- 2026-01-12 14:43 30 tmpclaude-7ad2-cwd -a---- 2026-01-12 14:41 30 tmpclaude-828f-cwd -a---- 2026-01-12 15:53 30 tmpclaude-8de4-cwd -a---- 2026-01-12 15:20 30 tmpclaude-97cb-cwd -a---- 2026-01-12 14:26 30 tmpclaude-9c5a-cwd -a---- 2026-01-12 14:43 30 tmpclaude-b4a6-cwd -a---- 2026-01-12 14:31 30 tmpclaude-c026-cwd -a---- 2026-01-12 14:41 30 tmpclaude-cdc3-cwd -a---- 2026-01-12 14:34 30 tmpclaude-dc22-cwd -a---- 2026-01-12 14:43 30 tmpclaude-e9ed-cwd -a---- 2026-01-12 14:43 30 tmpclaude-f4c4-cwd

?? tmpclaude-020b-cwd ?? tmpclaude-06ae-cwd ?? tmpclaude-0903-cwd ?? tmpclaude-0d70-cwd ?? tmpclaude-149c-cwd ?? tmpclaude-25d9-cwd ?? tmpclaude-2630-cwd ?? tmpclaude-2787-cwd ?? tmpclaude-324f-cwd ?? tmpclaude-32b3-cwd ?? tmpclaude-41fa-cwd ?? tmpclaude-4e36-cwd ?? tmpclaude-69e6-cwd ?? tmpclaude-6cf5-cwd ?? tmpclaude-779d-cwd ?? tmpclaude-7ad2-cwd ?? tmpclaude-828f-cwd ?? tmpclaude-8de4-cwd ?? tmpclaude-97cb-cwd ?? tmpclaude-9c5a-cwd ?? tmpclaude-b4a6-cwd ?? tmpclaude-c026-cwd ?? tmpclaude-cdc3-cwd ?? tmpclaude-dc22-cwd ?? tmpclaude-e9ed-cwd ?? tmpclaude-f4c4-cwd

comdexxsolutionsllc avatar Jan 12 '26 22:01 comdexxsolutionsllc

Confirming this issue on Windows 11 with Claude Code 2.1.5.

Additional observation: Setting CLAUDE_CODE_TMPDIR environment variable (added in 2.1.5 per the changelog) does NOT redirect these -cwd files. They continue to be created in the project's working directory regardless of the env var setting.

Workaround: Adding tmpclaude-* to .gitignore hides them from git status, but doesn't prevent their creation in the project directory.

westjan avatar Jan 12 '26 22:01 westjan

+1

banga87 avatar Jan 12 '26 23:01 banga87

+1

Aguila321 avatar Jan 13 '26 01:01 Aguila321

+1

aryamurray avatar Jan 13 '26 01:01 aryamurray

+1

Babadinho avatar Jan 13 '26 01:01 Babadinho

Additional reproduction data:

Claude Code version: 2.1.5 OS: Windows 11 Model: Tried on other model such as GLM 4.7

So i believe this is pure claude code issue.

dw4n avatar Jan 13 '26 01:01 dw4n