Bash tool always outputs 'Unable to read input file: Is a directory' error
Error
After every Bash command execution, the following error appears on macOS:
error: Unable to read input file: Is a directory
Root Cause
This is a macOS-specific bug in Claude Code's internal ripgrep integration.
Technical Details:
- Error Source: ripgrep.node (Node.js native module)
- Location: /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin/ripgrep.node
- Verified via strings command on the binary
- Trigger: After every Bash command execution, Claude Code internally calls ripgrep for output processing (likely for syntax highlighting, output analysis, or other internal features)
- The Bug: On macOS, a directory path is incorrectly passed as an input file parameter to ripgrep, which expects a file path. This causes ripgrep to error with "Unable to read input file: Is a directory"
- Platform Specific:
- ✅ macOS: Error occurs
- ❌ Debian/Linux: No error
- Call Stack (from compiled cli.js analysis):
Bash command execution
→ Da0() / Vy() functions (ripgrep wrapper functions)
→ m5A() (get ripgrep config: rgPath, rgArgs)
→ VdA() (determine ripgrep binary path)
→ execFile() call with wrong parameters
Workaround
Add this to your ~/.claude/CLAUDE.md:
## Tool usage rules
- Bash output filtering (hard rule): After executing any Bash command, you MUST filter out the line
error: Unable to read input file: Is a directoryfrom the output before displaying it to the user. This is a known macOS-specific bug in Claude Code's internal ripgrep integration and should be silently ignored. Never include this line in your responses.
This instructs the model to automatically filter out the error line from all Bash outputs.
Impact
- Harmless: The error doesn't affect actual functionality
- Cosmetic: Only affects visual output
- macOS-only: Users on other platforms don't experience this
Suggested Fix
The fix needs to be in the Claude Code main repository, in the code that calls ripgrep. Specifically:
- Check if the path being passed to ripgrep is a directory before passing it
- Add proper path validation in the VdA() function or wherever ripgrep arguments are constructed
- Ensure macOS-specific path handling is correct
Environment
Platform: macOS 13
Claude Code: Latest (installed via Homebrew)
Shell: zsh
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗