[BUG] Bash tool silently returns empty output when /tmp is full (ENOSPC)
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?
When /tmp (or the filesystem backing CLAUDE_CODE_TMPDIR) is full, the Bash tool silently returns empty stdout and empty stderr for every command. Exit codes vary (some 0, some 1). No error message is shown to the user. The session appears broken with no indication of the cause.
What Should Happen?
Claude Code should detect the ENOSPC condition and surface a clear error, e.g.: "Bash output unavailable: /tmp is full. Free disk space and retry." Similar to how a stale CWD produces "Working directory ... no longer exists. Please restart Claude."
Error Messages/Logs
None. That's the problem. All Bash output is silently empty.
Steps to Reproduce
- Fill /tmp to 100%:
dd if=/dev/zero of=/tmp/fillfile bs=1M count=99999 2>/dev/null - Start a Claude Code session (any project directory)
- Run any Bash command, e.g.:
echo hello - Observe: empty output, no error message
- Clean up:
rm /tmp/fillfile - Run the same Bash command. It works immediately
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.77
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
Root cause: the shell execution function (the one containing the string "Shell exec error:" and "Shell CWD") opens the task output file with openSync(path, O_WRONLY | O_CREAT | O_APPEND | O_NOFOLLOW) before the try/catch that wraps spawn(). When /tmp is full:
- The openSync may throw ENOSPC uncaught, since it's outside the spawn try/catch
- Or it creates a 0-byte inode but subsequent fd writes silently fail
TaskOutput.getStdout()reads back empty (the #readStdoutFromFile path returns "" when content is null)
The function already has good error handling for a stale CWD (returns a preSpawnError with the message "Working directory ... no longer exists"). The openSync for the output file needs similar treatment, wrapping it in a try/catch that returns a clear error like "/tmp is full (ENOSPC). Free disk space and retry.".
You can find the exact location by searching the source for the string literal "Shell exec error:". The openSync call is ~10 lines above the try/catch containing that string.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗