claude-code - 💡(How to fix) Fix PermissionRequest hook decision rendered 20+ times in UI for a single tool invocation [2 comments, 2 participants]

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…
GitHub stats
anthropics/claude-code#54995Fetched 2026-05-01 05:49:00
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×5commented ×2

When a PermissionRequest hook approves a tool call, the UI prints the Allowed by PermissionRequest hook line 20+ times under the same tool block, even though the hook script executes only once.

Root Cause

When a PermissionRequest hook approves a tool call, the UI prints the Allowed by PermissionRequest hook line 20+ times under the same tool block, even though the hook script executes only once.

Code Example

Read(.../some/file.js · lines 285-364)
Read 80 lines
Allowed by PermissionRequest hook
Allowed by PermissionRequest hook
Allowed by PermissionRequest hook
  ... (×20+)

---

echo "$(date +%s.%N) pid=$$ ppid=$PPID tool=$(jq -r '.tool_name' <<<\"\$input\")" \
    >> /tmp/read_allow_invocations.log

---

"hooks": {
  "PermissionRequest": [
    { "hooks": [ { "type": "command", "command": "bash ~/.claude/hooks/read_allow.sh" } ] }
  ]
}

---

{"hookSpecificOutput": {"hookEventName": "PermissionRequest", "decision": {"behavior": "allow"}}}
RAW_BUFFERClick to expand / collapse

Summary

When a PermissionRequest hook approves a tool call, the UI prints the Allowed by PermissionRequest hook line 20+ times under the same tool block, even though the hook script executes only once.

Environment

  • Claude Code: 2.1.123
  • OS: Linux 6.18 (Manjaro)
  • Settings: defaultMode: "auto", skipAutoPermissionPrompt: true (but not auto in this session)

Symptom

For a single Read (or other) tool call, the UI shows:

● Read(.../some/file.js · lines 285-364)
  ⎿  Read 80 lines
  ⎿  Allowed by PermissionRequest hook
  ⎿  Allowed by PermissionRequest hook
  ⎿  Allowed by PermissionRequest hook
  ... (×20+)

Diagnosis

Added per-invocation logging at the top of the hook script:

echo "$(date +%s.%N) pid=$$ ppid=$PPID tool=$(jq -r '.tool_name' <<<\"\$input\")" \
    >> /tmp/read_allow_invocations.log

Result: every tool invocation produces exactly one entry in the log, with spacing matching the actual tool-call cadence (seconds apart). No bursts of 20+ entries within milliseconds. So the hook script runs once; the UI duplicates the "Allowed by ..." line many times. This is a UI rendering / event-emission duplication bug, not a hook execution bug.

Hook config

Standard modern format in ~/.claude/settings.json:

"hooks": {
  "PermissionRequest": [
    { "hooks": [ { "type": "command", "command": "bash ~/.claude/hooks/read_allow.sh" } ] }
  ]
}

Hook returns:

{"hookSpecificOutput": {"hookEventName": "PermissionRequest", "decision": {"behavior": "allow"}}}

Possibly related issues

  • #29212 (closed, not planned) — about hook firing on every permission check. This report is specifically about the UI duplication on the approve path, with the underlying hook execution confirmed to be single-shot.

extent analysis

TL;DR

The UI rendering issue can be addressed by investigating the event emission and handling in the Claude Code UI component.

Guidance

  • Review the Claude Code UI component responsible for rendering the tool call output to identify potential causes of duplicated event emissions.
  • Verify that the PermissionRequest hook's output is correctly parsed and handled by the UI, ensuring that the "Allowed by PermissionRequest hook" line is not being unnecessarily duplicated.
  • Check for any caching or buffering mechanisms in the UI that might be causing the duplicated lines to be displayed.
  • Investigate if there are any other UI components or plugins that could be interfering with the rendering of the tool call output.

Example

No code snippet is provided as the issue is related to the UI rendering and event emission, which requires a deeper understanding of the Claude Code UI component.

Notes

The issue is specific to the UI rendering and event emission, and not related to the hook execution, which has been confirmed to be single-shot. The skipAutoPermissionPrompt setting being true but not in auto mode in this session may also be relevant to the issue.

Recommendation

Apply workaround: Investigate and fix the UI rendering issue, as the problem is not with the hook execution but with the UI displaying duplicated lines.

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

claude-code - 💡(How to fix) Fix PermissionRequest hook decision rendered 20+ times in UI for a single tool invocation [2 comments, 2 participants]