RCA-2026-04-03-001: Analysis
Root Cause
5 Whys Analysis
| Why # | Question and Answer |
|---|---|
1 |
Why wasn’t |
2 |
Why wasn’t |
3 |
Why was |
4 |
Why does this only affect Claude Code? |
5 |
Why wasn’t this caught before? |
Root Cause Statement
|
The Claude Code Bash tool shell environment has a malformed |
Contributing Factors
| Factor | Description | Preventable? |
|---|---|---|
Shell init order |
Claude Code may not source |
Partially (investigate init files) |
PATH construction |
A line like |
Yes (use absolute paths in exports) |
Rare Bash tool use |
Most work uses dedicated tools; PATH issues go unnoticed |
No (by design) |
Time pressure |
Incoming call compressed troubleshooting time |
No |
Shell Environment Deep Dive
How PATH Should Work
1. /etc/zsh/zshenv β System-wide, always sourced first
2. ~/.zshenv β User, always sourced
3. /etc/zsh/zprofile β System-wide, login shells only
4. ~/.zprofile β User, login shells only
5. /etc/zsh/zshrc β System-wide, interactive shells only
6. ~/.zshrc β User, interactive shells only
Standard /usr/bin comes from step 1 (/etc/zsh/zshenv) or is inherited from the parent process.
Debugging Commands
# Show raw PATH
echo $PATH
# Show PATH one-per-line (readable)
echo $PATH | tr ':' '\n'
# Check if /usr/bin is in PATH
echo $PATH | tr ':' '\n' | grep -x '/usr/bin'
# Find where PATH is set in zsh init files
grep -n 'PATH' ~/.zshenv ~/.zshrc ~/.zprofile 2>/dev/null
# Compare Claude Code shell vs terminal
# In terminal:
echo $PATH | tr ':' '\n' | wc -l
# Check what shell Claude Code uses
echo $SHELL
ps -p $$ -o comm=