claude-code - 💡(How to fix) Fix Plugin system overwrites env.PATH with literal ${PATH}, breaking basic shell commands [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45025Fetched 2026-04-09 08:15:04
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Fix Action

Workaround

Use absolute paths (e.g., /usr/bin/open) in Bash tool calls, or run commands in a regular terminal instead of via ! prefix in Claude Code.

Code Example

{
  "env": {
    "PATH": "/Users/me/.local/bin:...:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:..."
  }
}

---

~/.local/share/mise/shims:${PATH}:/Users/me/.claude/plugins/cache/hyperspell/setup/1.0.0/bin:/Users/me/.claude/plugins/cache/claude-plugins-official/rust-analyzer-lsp/1.0.0/bin:...

---

$ which open
open not found

$ echo $PATH | tr ':' '\n'
zsh: command not found: tr
RAW_BUFFERClick to expand / collapse

Bug

When plugins are enabled, the PATH environment variable contains the literal string ${PATH} instead of the expanded system PATH. This causes all standard system commands (open, tr, head, cat, ls, etc.) to be unavailable in Claude Code's Bash tool.

Expected behavior

The PATH set in ~/.claude/settings.jsonenv.PATH should be respected, and plugin paths should be appended to the resolved PATH — not overwrite it with an unexpanded ${PATH} placeholder.

Actual behavior

Despite having a correct env.PATH in settings.json:

{
  "env": {
    "PATH": "/Users/me/.local/bin:...:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:..."
  }
}

The actual PATH in the Bash tool session becomes:

~/.local/share/mise/shims:${PATH}:/Users/me/.claude/plugins/cache/hyperspell/setup/1.0.0/bin:/Users/me/.claude/plugins/cache/claude-plugins-official/rust-analyzer-lsp/1.0.0/bin:...

${PATH} is a literal string, not expanded. As a result, /usr/bin, /bin, /usr/sbin, /sbin are all missing, and basic macOS commands fail:

$ which open
open not found

$ echo $PATH | tr ':' '\n'
zsh: command not found: tr

Steps to reproduce

  1. Enable multiple plugins in settings.json (enabledPlugins)
  2. Set a valid env.PATH in settings.json
  3. Start a Claude Code session
  4. Run echo $PATH via the Bash tool — observe ${PATH} literal
  5. Run which open — fails

Environment

  • macOS (Darwin 25.4.0, Apple Silicon)
  • Shell: zsh
  • ~/.zshenv exists with correct PATH setup (works in regular terminal)
  • Multiple plugins enabled (superpowers, rust-analyzer-lsp, typescript-lsp, slack, etc.)

Workaround

Use absolute paths (e.g., /usr/bin/open) in Bash tool calls, or run commands in a regular terminal instead of via ! prefix in Claude Code.

extent analysis

TL;DR

The issue can be fixed by properly expanding the PATH environment variable in the Claude Code Bash tool, ensuring that the system PATH is respected and plugin paths are appended correctly.

Guidance

  • Verify that the env.PATH in ~/.claude/settings.json is correctly formatted and contains the expected system PATH.
  • Check if the issue is related to how the PATH variable is being set or expanded in the Bash tool, potentially involving shell configuration or plugin interactions.
  • Consider modifying the plugin configuration or the Bash tool's environment setup to ensure that the system PATH is properly expanded and appended with plugin paths.
  • To mitigate the issue, use absolute paths for commands or run them in a regular terminal instead of via the ! prefix in Claude Code.

Example

No specific code snippet is provided due to the lack of direct code references in the issue, but ensuring that the PATH variable is correctly expanded (e.g., using shell expansion or a similar mechanism) is key.

Notes

The solution may depend on the specific implementation details of the Claude Code Bash tool and how it handles environment variables and plugin configurations. The workaround using absolute paths or a regular terminal indicates that the issue is related to the environment setup within the Bash tool.

Recommendation

Apply a workaround by using absolute paths for commands or running them in a regular terminal, as the root cause of the PATH expansion issue may require deeper investigation into the Claude Code Bash tool's implementation or plugin interactions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The PATH set in ~/.claude/settings.jsonenv.PATH should be respected, and plugin paths should be appended to the resolved PATH — not overwrite it with an unexpanded ${PATH} placeholder.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING