[BUG] Git commit with heredoc always fails on first attempt when sandbox is enabled - system prompt fights itself
Resolved 💬 4 comments Opened Jan 17, 2026 by monsterhxw Closed Mar 8, 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?
Claude Code's built-in system prompt instructs using heredoc for git commit, but heredoc requires creating temp files in /tmp, which is blocked by Claude Code's own sandbox (only /tmp/claude/ is allowed). This causes every git commit to fail on the first attempt.
What Should Happen?
Git commit should succeed on the first attempt. The system prompt should use a sandbox-compatible approach like multiple -m flags instead of heredoc.
Error Messages/Logs
⏺ Bash(git commit -m "feat(claude): add sandbox and permission settings…)
⎿ Error: Exit code 1
(eval):1: can't create temp file for here document: operation not permitted
Aborting commit due to empty commit message.
Steps to Reproduce
- Enable sandbox mode in settings:
``json``
{
"sandbox": {
"enabled": true
}
}
- Stage some changes with git add
- Ask Claude to commit the changes
- Observe the first attempt fails with the error above
- Claude retries with -m flags and succeeds
Claude Model
Opus
Is this a regression?
I don't know.
Last Working Version
_No response_
Claude Code Version
2.1.9 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Ghostty/zsh
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗