Bug in Claude Code 2.0.71 - tries to readFileSync() on .claude directory
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?
Bug: /doctor crashes with EISDIR when .claude directory exists in project
Version: Claude Code 2.0.71
OS: macOS (Darwin 25.1.0)
Description
Running the /doctor command crashes with EISDIR: illegal operation on a directory, read when the current working directory contains a .claude directory. Claude Code appears to call readFileSync() on the .claude path without first checking if it's a directory.
Steps to Reproduce
- Create a .claude directory in your project: mkdir .claude
- Run Claude Code in that directory
- Execute the /doctor command
- Observe crash
Expected Behavior
/doctor should either:
- Skip directories when scanning for .claude files
- Use statSync() to check if path is a file before calling readFileSync()
- Handle the EISDIR error gracefully
Actual Behavior
/doctor crashes with:
EISDIR: illegal operation on a directory, read
Root Cause
The code path that reads .claude configuration files doesn't distinguish between .claude as a file vs .claude as a directory. When .claude is a directory (common for storing project-specific commands/config), readFileSync() fails.
Workaround
Added a shell function to temporarily rename the directory before running /doctor:
claude-doctor() {
if [[ -d ".claude" ]]; then
mv .claude .claude-backup
claude /doctor
mv .claude-backup .claude
else
claude /doctor
fi
}
Additional Context
- Project path: /opt/scout/.claude
- The .claude directory is used for project-specific commands per Claude Code documentation
What Should Happen?
/doctor should work in claude code without crashing.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Create a .claude directory in your project: mkdir .claude
- Run Claude Code in that directory
- Execute the /doctor command
- Observe crash
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.71
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗