Skip to content

[BUG] SessionStart hook shows 'hook error' on Windows when running alongside other plugins #369

@xiaobei930

Description

@xiaobei930

Description

When the superpowers plugin's SessionStart hook runs alongside other plugins' SessionStart hooks on Windows, Claude Code displays SessionStart:startup hook error in the UI, even though the hooks execute successfully.

Environment

  • OS: Windows 11
  • Claude Code version: Latest
  • Shell: Git Bash (via C:\Program Files\Git\bin\bash.exe)

Steps to Reproduce

  1. Install superpowers plugin
  2. Install another plugin that also has a SessionStart hook (e.g., cc-best)
  3. Start Claude Code

Expected Behavior

No error message displayed, or both hooks execute without UI error.

Actual Behavior

SessionStart:startup hook error

Debug Log Analysis

From claude --debug, the logs show:

Getting matching hook commands for SessionStart with query: startup
Found 2 hook matchers in settings
Matched 2 unique hooks for query "startup" (2 before deduplication)
...
Hooks: Parsed initial response: {}
Hooks: Initial response is not async, continuing normal processing
Successfully parsed and validated hook JSON output
Hook output does not start with {, treating as plain text

This indicates:

  1. Two SessionStart hooks are detected (superpowers + another plugin)
  2. One hook's JSON output is parsed successfully
  3. The other hook's output is treated as "plain text" (doesn't start with {)

Root Cause Analysis

The session-start.sh script outputs valid JSON when run directly:

bash /path/to/superpowers/hooks/session-start.sh
# Outputs valid JSON starting with {

However, when executed through Claude Code on Windows, something causes the output to not start with {. Possible causes:

  • BOM or invisible characters prepended by Git Bash on Windows
  • CRLF line ending issues
  • Shell environment differences when spawned by Claude Code

Related Issues

Workaround

Disabling superpowers plugin eliminates the error message. Other plugins' SessionStart hooks work correctly when superpowers is disabled.

Suggested Investigation

  1. Check if the bash script outputs any characters before the JSON on Windows
  2. Consider using a cross-platform approach (Node.js script) instead of bash
  3. Test with explicit UTF-8 encoding and LF line endings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions