Plugin hooks fail on Windows: wrong path format and CRLF line endings in shell scripts

Resolved 💬 4 comments Opened Feb 14, 2026 by trade-art Closed Mar 15, 2026

Description

Plugin stop/session-end hooks fail on Windows because of two issues in the plugin system:

1. Windows-style paths in hooks.json

The plugin installer generates hooks.json with Windows backslash paths (e.g., C:\Users\...), but hooks are executed via /bin/bash. Bash cannot resolve these paths, resulting in:

Stop hook error: Failed with non-blocking status code: /bin/bash:
C:Usersaitra.claudepluginsmarketplacesdesign-pluginsdesign-and-refinescriptscleanup-check.sh: No such file or directory

The backslashes are consumed as escape characters, producing a mangled path. The correct format for bash on Windows should be /mnt/c/Users/... or at minimum C:/Users/....

2. CRLF line endings in downloaded shell scripts

Plugin shell scripts (e.g., cleanup-check.sh) are downloaded with Windows CRLF line endings, causing:

cleanup-check.sh: line 2: $'\r': command not found
cleanup-check.sh: line 5: $'\r': command not found
cleanup-check.sh: line 32: syntax error: unexpected end of file

3. Version path not updated on upgrade

When a plugin upgrades (e.g., from 0.1.0 to 1.1.0), the cached hooks.json may still reference the old version directory path, causing:

/mnt/c/Users/aitra/.claude/plugins/cache/design-plugins/design-and-refine/0.1.0/scripts/cleanup-check.sh: No such file or directory

Affected Plugin

design-and-refine (but likely affects any plugin with shell-based hooks on Windows)

Environment

  • OS: Windows 11 Pro 10.0.26100
  • Shell: Git Bash (via /bin/bash)
  • Claude Code: CLI

Steps to Reproduce

  1. Install a plugin with shell-based hooks (e.g., design-and-refine) on Windows
  2. Start a Claude Code session
  3. End the session or stop Claude Code
  4. Observe stop hook errors

Expected Behavior

  • hooks.json should use bash-compatible paths (/mnt/c/... or forward slashes) when the hook executor is bash
  • Downloaded .sh scripts should have LF line endings, or be converted automatically
  • Plugin version upgrade should update all cached path references

Workaround

Manually fix the hooks.json files:

  1. Change paths from C:\Users\... to /mnt/c/Users/...
  2. Convert .sh scripts to LF: tr -d '\r' < script.sh > script.tmp && mv script.tmp script.sh

These fixes need to be reapplied after every plugin upgrade.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗