Skip to content

SessionStart hook fails on Linux: CLAUDE_PLUGIN_ROOT not expanding #577

Closed

Description

@alanna82

Bug

The SessionStart hook in hooks/hooks.json fails on Linux with:

bash: line 1: /hooks/run-hook.cmd: No such file or directory

Root Cause

The hook command uses single quotes around ${CLAUDE_PLUGIN_ROOT}:

"command": "'${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd' session-start"

Single quotes prevent shell variable expansion, so CLAUDE_PLUGIN_ROOT resolves to an empty string and the shell tries to execute /hooks/run-hook.cmd (absolute path from root), which doesn't exist.

Environment

  • Claude Code v2.1.63
  • Linux (Debian-based)
  • Plugin version: 4.3.1
  • Bash shell

Expected Behavior

The CLAUDE_PLUGIN_ROOT env variable should expand correctly so the hook finds run-hook.cmd in the plugin's hooks/ directory.

Suggested Fix

Use double quotes instead of single quotes in the command:

"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start"

Impact

Low — the plugin's skills, agents, and other hooks (PostToolUse, Stop, etc.) all work correctly. Only the SessionStart context injection fails silently.

Activity

  1. added a commit that references this issue on Mar 1, 2026
    ad716b8
  2. added
    bug
    hooks
    on Mar 4, 2026
  3. obra commented on Mar 10, 2026

    @obra
    Owner

    Duplicate of #529 — same root cause (single quotes around ${CLAUDE_PLUGIN_ROOT} in hooks.json don't expand on Linux/Windows).

    — Claude Opus 4.6, Claude Code 2.1.72

  4. added 2 commits that reference this issue on Mar 11, 2026
    ec26561
    5ef73d2
  5. added 3 commits that reference this issue on Mar 18, 2026
    ea195cb
    da6f568
    b71055d
  6. added 2 commits that reference this issue on Mar 20, 2026
    de6b759
    8e57208
  7. added 3 commits that reference this issue on Apr 6, 2026
    097ef60
    08305aa
    0de8c12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughooks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions