[Bug] PostToolUse hook blocks leave command pinned in terminal UI
Bug Description
ug Report: PostToolUse Hook Blocking Causes Command to Stay "Pinned" in UI
Summary
When a PostToolUse hook blocks an operation, the blocked command remains visually "pinned" in the Claude Code terminal UI, even after the agent continues with other responses. This creates a confusing UX where stale/blocked commands persist on screen.
Environment
- Claude Code CLI (latest)
- macOS
- PostToolUse hooks configured for Edit/Write tools
Steps to Reproduce
- Configure a PostToolUse hook that blocks certain edits:
{
"hooks": {
"PostToolUse": [{
"matcher": "Edit|Write",
"hooks": [{
"type": "command",
"command": "node ~/.claude/hooks/validator.js"
}]
}]
}
}
- Hook returns blocking response:
{"continue": false, "decision": "block", "reason": "Validation failed"}
- Make an edit that triggers the block
Expected Behavior
- The blocked command should disappear or be clearly marked as blocked
- Claude's subsequent response should replace the blocked command display
- The reason for blocking should be visible to both user and agent
Actual Behavior
- The blocked command stays "pinned" at the bottom of the terminal
- New responses from Claude appear above the pinned command
- The pinned command persists even after multiple subsequent interactions
- Creates visual clutter and confusion about what's currently happening
Screenshot Description
The UI shows:
[Claude's response text]
⏺ Update(file.ts) <-- This stays pinned
⎿ [diff content]
⎿ Running PostToolUse hooks… (1/4 done)
⎿ PostToolUse:Edit hook stopped continuation: Execution stopped by PostToolUse hook
Additional Context
- Issue persists regardless of exit code (tested with exit 0 and exit 2)
- Related issues: #4809, #11224, #4084
- The reason field from the hook response is not always visible to the agent, making it unable to understand why its edit was blocked
Workaround Attempted
Changed hooks to use exit 0 with {"decision": "block"} instead of exit 2, per documentation. Did not resolve the pinning issue.
Environment Info
- Platform: darwin
- Terminal: kitty
- Version: 2.0.76
- Feedback ID: f0b8e2ce-a7c5-4ba1-a65c-736799089cf4
Errors
[{"error":"Error: Plugin component file not found: /Users/alexgrama/.claude/plugins/cache/anthropic-agent-skills/document-skills/69c0b1a06741/skills/docx for document-skills\n at e65 (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:1212:9635)\n at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n at async t65 (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:1212:5804)\n at async file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:1212:14677\n at async LP (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:1212:22411)\n at async pM0.<anonymous> (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:4986:802)\n at async pM0.parseAsync (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:4760:4156)\n at async QV7 (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:5036:1647)\n at async tK7 (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:4971:1487)\n at async ZV7 (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:5038:5964)","timestamp":"2026-01-01T13:08:55.014Z"},{"error":"Error: Plugin component file not found: /Users/alexgrama/.claude/plugins/cache/anthropic-agent-skills/document-skills/69c0b1a06741/skills/pdf for document-skills\n at e65 (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:1212:9635)\n at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n at async t65 (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:1212:5804)\n at async file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:1212:14677\n at async LP (file:///Users/alexgrama/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modul
Note: Error logs were truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗