Bug Report: Claude Code Stop hook does not receive stdin on Windows (PowerShell 5.1 + pwsh 7)

Resolved 💬 6 comments Opened Apr 11, 2026 by ghost Closed May 26, 2026

Reporters: Kousei Izumida & ClaudeChat (Claude Sonnet 4.6)

---

Environment

  • OS: Windows 11
  • PowerShell: 5.1.26100.8115
  • Claude Code: v2.1.101
  • pwsh: 7.x (C:\Program Files\PowerShell\7\pwsh.exe)
  • bash: not present (where.exe bash returns no result)

---

Issue Summary

The Stop hook does not deliver stdin to the handler script on Windows when using pwsh as the executor.

Specifically:

  • [Console]::IsInputRedirected returns False inside the hook script
  • A full diagnostic dump script (checking stdin, environment variables, and command-line arguments) produced an empty log file
  • No data was received through any channel

The UserPromptSubmit hook using identical pwsh configuration works correctly and returns additionalContext as expected.

---

Configuration (settings.json hooks section)

"hooks": {
  "UserPromptSubmit": [{
    "hooks": [{
      "type": "command",
      "command": "pwsh -ExecutionPolicy Bypass -File C:\Users\kouse\.claude\hooks\inject-constraints.ps1"
    }]
  }],
  "Stop": [{
    "hooks": [{
      "type": "command",
      "command": "pwsh -ExecutionPolicy Bypass -File C:\Users\kouse\.claude\hooks\block-self-judgment.ps1"
    }]
  }]
}

---

Steps to Reproduce

  1. Install Claude Code v2.1.101 on Windows with pwsh 7 (no bash)
  2. Register a Stop hook pointing to a pwsh script
  3. In the script, check [Console]::IsInputRedirected and log all incoming data
  4. Trigger the Stop hook by completing a Claude Code session turn
  5. Observe: log file is empty, IsInputRedirected = False

Expected: Stop hook receives JSON context via stdin as documented
Actual: stdin is empty, IsInputRedirected = False

---

Note

We are using hooks to enforce output constraints (blocking self-judgment phrases) as a governance layer for an AI automation pipeline. This issue prevents the Stop hook from functioning as a structural safety gate on Windows.

We would appreciate guidance on:

  1. Whether stdin delivery for Stop hooks is supported on Windows
  2. Whether there is an alternative delivery method (env vars, args) on Windows
  3. Whether this is a known issue with a workaround

---

Sincerely,
Kousei Izumida & ClaudeChat
MIRAI AI Orchestra
Iwaki, Fukushima, Japan

View original on GitHub ↗

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