claude-code - 💡(How to fix) Fix `${CLAUDE_PLUGIN_ROOT}` is not expanded for `statusLine.command` (works for hooks/MCP/LSP/monitors) [1 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#52079Fetched 2026-04-23 07:37:07
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
0
Participants
Timeline (top)
labeled ×5referenced ×2cross-referenced ×1

The plugins reference documents ${CLAUDE_PLUGIN_ROOT} as a variable expanded inside plugin component commands. In practice the variable is populated for hook, MCP, LSP, and monitor subprocesses, but absent from the statusLine.command subprocess. Plugins that follow the documented pattern silently render no statusline.

Root Cause

The plugins reference documents ${CLAUDE_PLUGIN_ROOT} as a variable expanded inside plugin component commands. In practice the variable is populated for hook, MCP, LSP, and monitor subprocesses, but absent from the statusLine.command subprocess. Plugins that follow the documented pattern silently render no statusline.

Fix Action

Fix / Workaround

Workaround until fixed

RAW_BUFFERClick to expand / collapse

Version: Claude Code 2.1.117 (also reproduced on 2.1.112), macOS 15

Summary

The plugins reference documents ${CLAUDE_PLUGIN_ROOT} as a variable expanded inside plugin component commands. In practice the variable is populated for hook, MCP, LSP, and monitor subprocesses, but absent from the statusLine.command subprocess. Plugins that follow the documented pattern silently render no statusline.

Scope

The bug is specific to the statusLine subprocess environment. The same plugin's hooks resolve ${CLAUDE_PLUGIN_ROOT} correctly. So this is not a general plugin-variable expansion issue — it is a missing-env case for statusLine specifically.

Reproduced with derjochenmeyer/claude-code-craft-statusline.

Reproducer

  1. Install any plugin that ships a renderer at <plugin-root>/scripts/foo.sh.
  2. In ~/.claude/settings.json: ```json "statusLine": { "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/scripts/foo.sh" } ```
  3. No statusline appears.

Diagnostic trace

Wrapping the statusLine command with a logger that dumps `env` reveals `CLAUDE_PLUGIN_ROOT` (and `CLAUDE_PLUGIN_DATA`) are absent from the statusLine subprocess, and the plugin's `bin/` directory is not in `PATH` either:

``` --- ENV (CLAUDE/PLUGIN only) --- CLAUDE_CODE_ENTRYPOINT=cli CLAUDE_CODE_NO_FLICKER=1 CLAUDE_PROJECT_DIR=<project>

--- plugin bin dirs in PATH --- (none)

--- RENDERER raw=/scripts/foo.sh --- RENDERER_RESOLVED=missing (CLAUDE_PLUGIN_ROOT not expanded) ```

Expected

`${CLAUDE_PLUGIN_ROOT}` (and ideally `${CLAUDE_PLUGIN_DATA}`) should be populated in the statusLine subprocess environment, matching the behavior already in place for hooks, MCP servers, LSP servers, and monitors. Alternatively, please document the limitation explicitly so plugin authors do not rely on it.

Workaround until fixed

POSIX shell default expansion in the command string works, since the statusline docs state the command runs in a shell:

```json "command": "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/<marketplace>/scripts/foo.sh}" ```

The `marketplaces/` clone path is version-stable across plugin updates. Once the variable is properly populated, the same line transparently uses the official plugin root.

extent analysis

TL;DR

The most likely fix is to modify the statusLine.command to use POSIX shell default expansion until the CLAUDE_PLUGIN_ROOT variable is properly populated in the statusLine subprocess environment.

Guidance

  • Verify that the issue is specific to the statusLine subprocess environment by checking if the CLAUDE_PLUGIN_ROOT variable is populated in other subprocesses like hooks, MCP, LSP, and monitors.
  • Use the provided workaround by modifying the statusLine.command to use POSIX shell default expansion, as shown in the issue body, to ensure the plugin's script is executed correctly.
  • Check the ~/.claude/settings.json file to ensure the statusLine configuration is correct and the command is properly formatted.
  • Monitor the issue for updates and apply the official fix once it is available, which should populate the CLAUDE_PLUGIN_ROOT variable in the statusLine subprocess environment.

Example

"statusLine": {
  "type": "command",
  "command": "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/<marketplace>/scripts/foo.sh}"
}

This example shows how to use POSIX shell default expansion to provide a fallback value for the CLAUDE_PLUGIN_ROOT variable.

Notes

The provided workaround relies on the marketplaces/ clone path being version-stable across plugin updates. Once the CLAUDE_PLUGIN_ROOT variable is properly populated, the same line will transparently use the official plugin root.

Recommendation

Apply the workaround by modifying the statusLine.command to use POSIX shell default expansion, as it provides a reliable solution until the official fix is available.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix `${CLAUDE_PLUGIN_ROOT}` is not expanded for `statusLine.command` (works for hooks/MCP/LSP/monitors) [1 participants]