Bash tool loses HOME and PATH env vars in some sessions
Resolved 💬 4 comments Opened Mar 2, 2026 by keifgwinn Closed Mar 30, 2026
Description
Some Claude Code sessions start with HOME and PATH environment variables set to empty strings in the Bash tool. This breaks ~ expansion, binary resolution, and any command that depends on the user's home directory.
Reproduction
In a new Claude Code session, run via Bash tool:
echo "HOME=$HOME"
echo "PATH=$PATH"
In affected sessions, both return empty strings:
HOME=
PATH=
Impact
~expands to nothing, so paths like~/.configresolve to/.config- Commands that rely on PATH fail to find binaries
- Any tool that reads from the home directory (git config, SSH keys, application configs) breaks silently
- Workaround: prefix every Bash command with
HOME=/Users/<username>— tedious and error-prone
Environment
- macOS 15 (Sequoia), Darwin 24.6.0
- Claude Code (latest as of 2026-03-02)
- Occurs intermittently — not every session, but frequently enough to be disruptive
Expected Behavior
HOME and PATH should always be initialized from the user's shell profile, matching what the user sees in their terminal.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗