[BUG] Sandbox creates placeholder files in project directory

Resolved 💬 3 comments Opened Jan 16, 2026 by mikafouenski Closed Jan 20, 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?

Hello

When sandbox mode is enabled, Claude Code creates empty 0-byte placeholder files in the project's working directory instead of a temporary location. These files appear in git status as untracked and persist after the session.

Actual behavior

Empty files created in CWD:

  • .bash_profile, .bashrc, .profile, .zprofile, .zshrc
  • .gitconfig, .gitmodules
  • .ripgreprc
  • .idea, .vscode (as files, not directories)
  • .claude/commands (as file)

Environment

  • Claude Code version: 2.1.9
  • OS: Linux 6.18.4-arch1-1
  • Shell: zsh
  • Sandbox settings: { "enabled": true, "autoAllowBashIfSandboxed": true }

Workaround

Add files to .gitignore and delete them manually.

What Should Happen?

Placeholder files should either:

  • Not be created (just block the read operation)
  • Be created in TMPDIR, not the project directory
  • Be cleaned up when the session ends

Error Messages/Logs

Steps to Reproduce

  1. Enable sandbox: "sandbox": { "enabled": true } in settings.local.json
  2. Start a Claude Code session in any git repository
  3. Run git status - observe untracked files

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.9

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Xterm

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗