[BUG] settings.json: Incorrect variable expansion
Resolved 💬 2 comments Opened Jan 28, 2026 by malthejorgensen Closed Mar 1, 2026
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 setting the $PATH environment variable in the env-key in settings.json it gets both expanded and appended. So having the following .claude/settings.json in a project:
// <project_dir>/.claude/settings.json
{
"env": {
"PATH": "/home/user/bin:$PATH"
}
}
will result in something like (inside the Claude Code bash environment):
● Bash(echo $PATH)
⎿ /home/user/bin:/home/user/.local/bin:/home/user/bin:$PATH:/snap/bin
To further enlighten us, if we set:
// <project_dir>/.claude/settings.json
{
"env": {
"PATH": "/home/user/bin:{$PATH}"
}
}
it becomes:
● Bash(echo "$PATH")
⎿ /home/user/bin:{/home/user/.local/bin:/home/user/bin:{$PATH}:/snap/bin}
So obviously, some weird incorrect expansion is happening.
What Should Happen?
We should end with something like:
● Bash(echo "$PATH")
⎿ /home/user/bin:/home/user/.local/bin:/home/user/bin:/snap/bin}
Error Messages/Logs
Steps to Reproduce
- Put the following in your project
.claude/settings.json:
{
"env": {
"PATH": "/home/user/bin:$PATH"
}
}
- Ask Claude Code to print the
$PATHenvironment variable.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.22 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗