claude-code - 💡(How to fix) Fix [BUG] Claude Code creates 17+ empty files (.env, .npmrc, package.json, node_modules) in working directory on every startup [2 comments, 1 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#46165Fetched 2026-04-11 06:27:25
View on GitHub
Comments
2
Participants
1
Timeline
2
Reactions
1
Participants
Timeline (top)
commented ×2

Since updating to ~v2.1.98, Claude Code creates 17+ empty 0-byte files and an empty node_modules/.bin/ directory in the working directory on every startup. This happens via the VSCode/VSCodium extension — the native-binary/claude process creates these files before any user interaction.

Error Message

Before ~v2.1.98, the sandbox worked fine without socat installed. After updating, the sandbox fails with Sandbox failed to initialize. unless socat is explicitly installed (sudo dnf install socat). The error message gives no hint that socat is missing.

Root Cause

Since updating to ~v2.1.98, Claude Code creates 17+ empty 0-byte files and an empty node_modules/.bin/ directory in the working directory on every startup. This happens via the VSCode/VSCodium extension — the native-binary/claude process creates these files before any user interaction.

Fix Action

Fix / Workaround

Current workaround

Code Example

.env, .env.local, .env.development, .env.development.local,
.env.test, .env.test.local, .env.production, .env.production.local,
.npmrc, .yarnrc, .yarnrc.yml, .gitmodules,
bunfig.toml, package.json, package-lock.json,
pnpm-lock.yaml, yarn.lock, node_modules/.bin/ (empty dir)

---

11:53:07 /home/user/Downloads/.npmrc CREATE
11:53:07 /home/user/Downloads/.yarnrc CREATE
11:53:07 /home/user/Downloads/.yarnrc.yml CREATE
11:53:07 /home/user/Downloads/bunfig.toml CREATE
11:53:07 /home/user/Downloads/package.json CREATE
11:53:07 /home/user/Downloads/.gitmodules CREATE
11:53:07 /home/user/Downloads/package-lock.json CREATE
11:53:07 /home/user/Downloads/yarn.lock CREATE
11:53:07 /home/user/Downloads/pnpm-lock.yaml CREATE
11:53:07 /home/user/Downloads/.env CREATE
... (all 17 files at same second)
11:53:07 /home/user/Downloads/node_modules CREATE,ISDIR

---

/home/user/.vscode-oss/extensions/anthropic.claude-code-2.1.100-linux-x64/resources/native-binary/claude
  --output-format stream-json --verbose --permission-mode acceptEdits ...

---

# Bash alias to clean up
alias ccclean='rm -rf ~/{.env,.env.*,.npmrc,.yarnrc,.yarnrc.yml,bunfig.toml,package.json,package-lock.json,pnpm-lock.yaml,yarn.lock,.gitmodules,node_modules} ~/Downloads/{.env,.env.*,.npmrc,.yarnrc,.yarnrc.yml,bunfig.toml,package.json,package-lock.json,pnpm-lock.yaml,yarn.lock,.gitmodules,node_modules} 2>/dev/null'
RAW_BUFFERClick to expand / collapse

Description

Since updating to ~v2.1.98, Claude Code creates 17+ empty 0-byte files and an empty node_modules/.bin/ directory in the working directory on every startup. This happens via the VSCode/VSCodium extension — the native-binary/claude process creates these files before any user interaction.

Files created (all 0 bytes, all within <1ms)

.env, .env.local, .env.development, .env.development.local,
.env.test, .env.test.local, .env.production, .env.production.local,
.npmrc, .yarnrc, .yarnrc.yml, .gitmodules,
bunfig.toml, package.json, package-lock.json,
pnpm-lock.yaml, yarn.lock, node_modules/.bin/ (empty dir)

Environment

  • OS: Fedora 43, SELinux enforcing, hardened desktop
  • IDE: VSCodium 1.99.x (RPM, not Flatpak)
  • Claude Code: 2.1.98 → 2.1.100 (bug persists across updates)
  • Extension: anthropic.claude-code-2.1.100-linux-x64
  • Working directory: ~/Downloads (configured in VSCodium)
  • Shell: Bash 5.2

Reproduction

  1. Install Claude Code extension in VSCode/VSCodium
  2. Set working directory to any folder (e.g. ~/Downloads)
  3. Start VSCode/VSCodium
  4. Observe: 17 empty files + node_modules/.bin/ appear in the working directory

Confirmed with inotifywait:

11:53:07 /home/user/Downloads/.npmrc CREATE
11:53:07 /home/user/Downloads/.yarnrc CREATE
11:53:07 /home/user/Downloads/.yarnrc.yml CREATE
11:53:07 /home/user/Downloads/bunfig.toml CREATE
11:53:07 /home/user/Downloads/package.json CREATE
11:53:07 /home/user/Downloads/.gitmodules CREATE
11:53:07 /home/user/Downloads/package-lock.json CREATE
11:53:07 /home/user/Downloads/yarn.lock CREATE
11:53:07 /home/user/Downloads/pnpm-lock.yaml CREATE
11:53:07 /home/user/Downloads/.env CREATE
... (all 17 files at same second)
11:53:07 /home/user/Downloads/node_modules CREATE,ISDIR

Files are also created in ~ (home root), not just the working directory.

Process responsible

/home/user/.vscode-oss/extensions/anthropic.claude-code-2.1.100-linux-x64/resources/native-binary/claude
  --output-format stream-json --verbose --permission-mode acceptEdits ...

Additional finding: Sandbox regression

Before ~v2.1.98, the sandbox worked fine without socat installed. After updating, the sandbox fails with Sandbox failed to initialize. unless socat is explicitly installed (sudo dnf install socat). The error message gives no hint that socat is missing.

After installing socat, the sandbox also requires a .claude/ directory in the working directory to exist — otherwise bwrap fails with Can't mkdir /path/.claude: Not a directory.

Timeline:

  • Before v2.1.98: Sandbox works, no socat needed, no ghost files
  • After v2.1.98: Sandbox broken (needs socat), ghost files on every startup

Impact

  • Pollutes working directories with JS ecosystem files on a system that has no Node.js/npm installed
  • Confuses users who see unexpected files appear
  • Can interfere with git repositories (files show as untracked)
  • node_modules directory is particularly alarming on a hardened system

Current workaround

# Bash alias to clean up
alias ccclean='rm -rf ~/{.env,.env.*,.npmrc,.yarnrc,.yarnrc.yml,bunfig.toml,package.json,package-lock.json,pnpm-lock.yaml,yarn.lock,.gitmodules,node_modules} ~/Downloads/{.env,.env.*,.npmrc,.yarnrc,.yarnrc.yml,bunfig.toml,package.json,package-lock.json,pnpm-lock.yaml,yarn.lock,.gitmodules,node_modules} 2>/dev/null'

Expected behavior

Claude Code should not create any files in the user's working directory on startup. If these files are needed for internal operation, they should be in ~/.claude/ or a temp directory, not the workspace root.

extent analysis

TL;DR

The most likely fix is to configure Claude Code to use a temporary directory or a specific directory like ~/.claude/ for its internal operations, rather than the user's working directory.

Guidance

  • Investigate the --output-format and --permission-mode options used by the claude process to see if they can be modified to prevent file creation in the working directory.
  • Consider setting the working directory in VSCodium to a temporary directory or a directory specifically designated for Claude Code's use.
  • Look into the native-binary/claude process's configuration to see if there are any options to specify a different directory for its output.
  • Verify that the ccclean alias is working as expected to clean up the unwanted files, and consider running it automatically on startup or shutdown of VSCodium.

Example

No code snippet is provided as it is not clearly supported by the issue, but the ccclean alias can be used as a temporary workaround:

alias ccclean='rm -rf ~/{.env,.env.*,.npmrc,.yarnrc,.yarnrc.yml,bunfig.toml,package.json,package-lock.json,pnpm-lock.yaml,yarn.lock,.gitmodules,node_modules} ~/Downloads/{.env,.env.*,.npmrc,.yarnrc,.yarnrc.yml,bunfig.toml,package.json,package-lock.json,pnpm-lock.yaml,yarn.lock,.gitmodules,node_modules} 2>/dev/null'

Notes

The issue seems to be related to a change in the claude process's behavior in version 2.1.98, and the exact solution may depend on the specifics of the Claude Code extension and its configuration.

Recommendation

Apply the workaround using the ccclean alias until a more permanent solution is found, as it is unclear if upgrading to a fixed version is possible at this time.

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…

FAQ

Expected behavior

Claude Code should not create any files in the user's working directory on startup. If these files are needed for internal operation, they should be in ~/.claude/ or a temp directory, not the workspace root.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Claude Code creates 17+ empty files (.env, .npmrc, package.json, node_modules) in working directory on every startup [2 comments, 1 participants]