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

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

/usr/bin/bash: line 1: echo: write error: Permission denied 4. Observe: UserPromptSubmit operation blocked by hook ... echo: write error: Permission denied

Root Cause

Root Cause Hypothesis

Fix Action

Fix / Workaround

Workaround

RAW_BUFFERClick to expand / collapse

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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING