[Regression v2.1.153] Plugin bash hooks fail with "echo: write error: Permission denied" on Windows (claude-mem, shell: "bash")

Resolved 💬 1 comment Opened May 28, 2026 by alejandro2go Closed Jun 28, 2026

### 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

  1. Windows 11, Claude Code v2.1.153
  2. Enable claude-mem@thedotmack plugin
  3. Send any prompt
  4. 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

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗