Skip to content

Plugin bash hooks fail on Windows due to mixed path separators in CLAUDE_PLUGIN_ROOT #18527

Description

@eward4580

Bug Description

Plugin bash hooks fail on Windows because CLAUDE_PLUGIN_ROOT is set to a Windows-style path (with backslashes), but the hook command passes this path to bash which cannot resolve the mixed path format.

Error Message

Stop hook error: Failed with non-blocking status code: /bin/bash: line 1: C:\Program Files\ClaudeCode\plugins\cache\claude-plugins-official\ralph-loop\96276205880a/hooks/stop-hook.sh: No such file or directory

Root Cause Analysis

  1. Plugin hooks.json defines:

    "command": "bash -c \"\\\"${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh\\\"\""
  2. Claude Code sets CLAUDE_PLUGIN_ROOT to Windows path:

    C:\Program Files\ClaudeCode\plugins\cache\claude-plugins-official\ralph-loop\96276205880a
    
  3. When expanded, bash receives:

    bash -c "C:\Program Files\ClaudeCode\...\hooks/stop-hook.sh"
    
  4. Bash (Git Bash/MSYS2) cannot resolve this mixed-separator path

Expected Behavior

Claude Code should convert Windows paths to Unix-style paths (e.g., /c/Program Files/...) when:

  • The hook command uses bash
  • Running on Windows with Git Bash/MSYS2

Environment

  • OS: Windows 11 Pro for Workstations (Build 26200)
  • Claude Code: Latest version
  • Shell: Git Bash (MSYS2)
  • Affected Plugin: ralph-loop@claude-plugins-official (and likely any plugin using bash hooks)

Workaround

The MCP-based ralph_loop tool works correctly. Only the plugin-based bash hooks are affected.

Suggested Fix

In the plugin hook executor, when running on Windows and the command starts with bash:

  1. Convert CLAUDE_PLUGIN_ROOT from C:\path\to\plugin to /c/path/to/plugin
  2. Or provide a separate CLAUDE_PLUGIN_ROOT_UNIX variable for bash hooks

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

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions