[BUG] ENV_SCRUB=1 appends a duplicate "claude-code scrub-mode stubs" block to .git/info/exclude on every session

Status Open
Reported on v2.1.236
Maintainer reply None cached
Activity 0 comments · opened Oct 12, 2026

Filing this separately so it can be tracked on its own: it was first reported in a comment on #84954 (2026-09-03, 2.1.236, 224 identical copies, 62 KB), but that issue is about a different block (# claude-code-runtime) on Windows and has no triage labels yet. The bug is still present on 2.1.287.

Environment

  • Claude Code 2.1.287 (native build), Ubuntu 24.04, bubblewrap installed
  • CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1

What happens

Every session appends a new # claude-code scrub-mode stubs block to .git/info/exclude without checking whether the block is already there. The file grows by about 19 lines per session. Two repositories I use daily had 21 and 32 identical copies of the block.

Reproduction

mkdir r && cd r && git init -q
export CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1
claude -p "Reply with exactly: pong"
claude -p "Reply with exactly: pong"
grep -c 'claude-code scrub-mode stubs' .git/info/exclude   # prints 2, one per session

No tool calls are needed. Each run exits 0.

Expected

The block is written once. If it is already present, it is not appended again.

Notes

  • This is separate from the placeholder files themselves (#78072, where the placeholders are described as intended behaviour). Duplicating the block is not covered by that.
  • The #84954 comment also reports that .git/info/exclude is in the sandbox's read-only bind-mount set, so neither Claude Code nor an agent running under it can trim the file it keeps growing; it has to be cleaned from a shell outside Claude Code. I have not verified this part myself.

View original on GitHub ↗