[Regression v2.1.153] Plugin bash hooks fail with "echo: write error: Permission denied" on Windows (claude-mem, shell: "bash")
### What's Wrong?
Since upgrading to v2.1.153 (auto-updated on 2026-05-27), plugin hooks that declare
"shell": "bash" are blocked on every UserPromptSubmit event with:
UserPromptSubmit operation blocked by hook: [...]:
/usr/bin/bash: line 1: echo: write error: Permission denied
The failing hook is claude-mem@thedotmack. All its hooks start with:
export PATH="$($SHELL -lc 'echo $PATH' 2>/dev/null):$PATH"
On Windows, the bash subprocess spawned by Claude Code's hook runner has its stdout
write-restricted — echo $PATH inside the $() subshell gets Permission denied,
causing the hook to exit non-zero and block the prompt.
The same command runs fine when invoked manually from Git Bash. Failure is specific
to the hook execution environment in v2.1.153.
### Root Cause Hypothesis
v2.1.153 includes: "Fixed a permission-prompt bypass where bare variable assignments
to non-allowlisted environment variables in Bash commands were auto-approved."
This security fix appears to have changed how bash hook subprocesses are piped on
Windows — stdout is now write-restricted in a way that breaks echo inside a login
subshell.
### Steps to Reproduce
- Windows 11, Claude Code v2.1.153
- Enable
claude-mem@thedotmackplugin - Send any prompt
- Observe:
UserPromptSubmit operation blocked by hook ... echo: write error: Permission denied
### What Should Happen?
Hook runs successfully as it did on v2.1.152 and earlier.
### Workaround
Disable the plugin: set "claude-mem@thedotmack": false in ~/.claude/settings.json.
### Related: #60800
### Claude Code Version: 2.1.153
### OS: Windows 11 Home 10.0.26200
### Shell: PowerShell / Git Bash
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗