Claude Code Bash tool hits E2BIG when sandbox profiles scale with large git worktrees
jkMLnop · ghdev · 2026-07-17
A Claude Code bug report shows Bash tool calls failing with spawn E2BIG whenever the working directory is inside a non-trivial git repository.
Main finding
The command itself is not the problem. The compiled sandbox filesystem policy grows with the repository's working-tree file count until the OS argument-length limit is exceeded. The report says the error mentions around 187 filesystem deny paths and a compiled profile around 1–1.1 MB.
Repro pattern
The failure appears to require both of these conditions:
- cwd is inside a git repo
- the repo has a sufficiently large working tree
Observed behavior:
- non-git directories did not fail, even with 377,000+ files
- a git repo with one file worked
- git repos with 148+ working-tree files consistently failed, up to roughly 40,000 files
What was ruled out
The reporter says they tested and eliminated several plausible causes, including:
- git internals / reflog file count
- .claude/commands
- per-project Claude Code session history
- secret-filename pattern matching
The report concludes that the pattern is robust, but the exact internal code path still needs source access to identify.
More from coding & agent
- A 9B Ollama agent can run a fully local DJ radio with tools, memory, and TTS — pinku1 · 2026-07-27
- Bugbot rejects an MCP permission flag because it would break path-scoped isolation — zeeg · 2026-07-27
- One GPT-5.6 agent is guarding a Blink security system while another makes a parody rap album — repligate · 2026-07-27
- An agent got unblocked by reusing a logged-in browser, not stealth tricks — armanidev_ · 2026-07-27
- Paper argues graph topology can become the core operating system for AI agents — theomitsa · 2026-07-27
- Claude Code desktop adds UI markup feedback for smoother visual editing — EricBuess · 2026-07-27