Skip to content

Windows: ${CLAUDE_PLUGIN_ROOT} backslashes stripped when passed to bash hooks #22449

Description

@puneet1409

Description

On Windows, when a plugin hook uses ${CLAUDE_PLUGIN_ROOT} in its command, the backslashes in the Windows path are stripped when the command is passed to bash.

Steps to Reproduce

  1. Install the superpowers plugin on Windows
  2. Start a new Claude Code session
  3. Observe the startup hook error

Expected Behavior

The path should be correctly passed to bash. Either:

  • Convert backslashes to forward slashes (bash on Windows handles these)
  • Properly escape the backslashes

Actual Behavior

From debug log:

Hook SessionStart:startup (SessionStart) error:
/bin/bash: C:Userspunee.claudepluginscacheclaude-plugins-officialsuperpowers4.1.1/hooks/session-start.sh: No such file or directory

The path C:\Users\punee\.claude\plugins\cache\claude-plugins-official\superpowers\4.1.1 becomes C:Userspunee.claudepluginscacheclaude-plugins-officialsuperpowers4.1.1 (all backslashes removed).

Workaround

Manually edit the plugin's hooks.json to use a hardcoded path with forward slashes:

"command": "C:/Users/username/.claude/plugins/cache/claude-plugins-official/superpowers/4.1.1/hooks/session-start.sh"

Environment

  • Claude Code version: 2.1.29
  • OS: Windows 11
  • Bash: GNU bash 5.2.37 (Git Bash)

Additional Context

The hooks.json in superpowers plugin uses:

"command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh"

This variable interpolation works on macOS/Linux but fails on Windows due to the backslash handling.

Activity

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

    area:toolsbugSomething isn't workingduplicateThis issue or pull request already existshas reproHas detailed reproduction stepsplatform:windowsIssue specifically occurs on WindowsstaleIssue is inactive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions