Plugin manager does not preserve execute permissions on hook scripts

Status Fixed / completed
Maintainer reply ✓ Yes — ashwin-ant
Activity 5 comments · opened Mar 27, 2026 · closed Apr 18, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

Description

Plugin hook scripts installed via claude plugin install are missing execute permissions (-rw-r--r-- instead of -rwxr-xr-x), causing SessionStart hooks to fail with exit code 126 (permission denied).

Reproduction

  1. Install a plugin that includes shell-based hooks (e.g., explanatory-output-style@claude-plugins-official or learning-output-style@claude-plugins-official)
  2. Start a new Claude Code session
  3. Observe SessionStart:startup hook error

Root cause

The plugin manager writes hook scripts to ~/.claude/plugins/marketplaces/ without the execute bit set. The cached copies (under ~/.claude/plugins/cache/) from earlier installs do have +x, suggesting this is a regression in the install/update path — likely the marketplace sync or file extraction step strips execute permissions.

Evidence:

# Cached (older, working):
-rwxr-xr-x  .../cache/.../session-start.sh   (Mar 20-24)

# Marketplace (current, broken):
-rw-r--r--  .../marketplaces/.../session-start.sh   (Mar 28)

Affected plugins

  • explanatory-output-style@claude-plugins-official
  • learning-output-style@claude-plugins-official
  • Potentially any plugin with shell hook scripts

Workaround

chmod +x ~/.claude/plugins/marketplaces/claude-plugins-official/plugins/*/hooks-handlers/*.sh

Note: This workaround may need to be reapplied after plugin updates.

Environment

  • macOS (Darwin 25.2.0)
  • Claude Code CLI (latest)

View original on GitHub ↗

5 Comments

yurukusa · 6 months ago

Same workaround as #40280 — a SessionStart hook that auto-fixes permissions:

{
  "hooks": {
    "SessionStart": [{
      "hooks": [{
        "type": "command",
        "command": "find ~/.claude/plugins -name \"*.sh\" ! -perm -u+x -exec chmod +x {} + 2>/dev/null"
      }]
    }]
  }
}

This runs before any other hooks fire, so it fixes the permission-denied error before it can occur. Works on both macOS and Linux.

yurukusa · 6 months ago

A Notification start hook can automatically fix execute permissions on hook scripts:

find "$HOME/.claude/plugins" -name "*.sh" ! -perm -111 -exec chmod +x {} \; 2>/dev/null
find "$HOME/.claude/hooks" -name "*.sh" ! -perm -111 -exec chmod +x {} \; 2>/dev/null
find ".claude/hooks" -name "*.sh" ! -perm -111 -exec chmod +x {} \; 2>/dev/null
exit 0
// ~/.claude/settings.json
{
  "hooks": {
    "Notification": [{
      "matcher": "start",
      "hooks": [{ "type": "command", "command": "bash ~/.claude/hooks/fix-hook-perms.sh" }]
    }]
  }
}

Runs at every session start — automatically restores +x permission on any hook script that lost it during plugin install/update.

marlvinvu · 6 months ago

My Claude says your issue is similar to issues #39931, #39954, and #40009. Let Anthropic pay more attention to this recurring problem.

ashwin-ant collaborator · 6 months ago

This was fixed in v2.1.86 — The plugin manager now preserves execute permissions on hook scripts across all extraction paths. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.