[BUG] UserPromptSubmit hook rejection reason never displayed (Desktop + VS Code)

Open 💬 1 comment Opened Jul 2, 2026 by pb-sameerreddy

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When a UserPromptSubmit hook blocks a prompt (either via decision: "block" with a reason, or by exiting with code 2), Claude Code correctly prevents the prompt from reaching the model but never displays the rejection reason to the user. The UI appears stuck — no feedback, no explanation. Affects both Claude Code Desktop and the VS Code extension.

This was previously reported in:

  • #59822 — closed as stale/inactive (not fixed)
  • #58269 — closed as stale (not fixed; also identified the root cause below)

Root cause (identified in #58269): The webview classifier in webview/index.js handles <post-tool-use-hook> output but has no corresponding case for <user-prompt-submit-hook>. The fix suggested in #58269 is to add a <user-prompt-submit-hook> case mirroring the existing <post-tool-use-hook> handler.

What Should Happen?

When a UserPromptSubmit hook blocks a prompt, the rejection reason returned by the hook should be clearly displayed to the user — matching the behavior already implemented for PostToolUse hooks and matching how the CLI renders it.

Steps to Reproduce

  1. Add a UserPromptSubmit hook to your settings (e.g. managed-settings.json or settings.json) that blocks prompts and returns a reason:
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "echo '{\"decision\": \"block\", \"reason\": \"This prompt was blocked by policy.\"}' && exit 0"
          }
        ]
      }
    ]
  }
}
  1. Launch Claude Code Desktop (or the VS Code extension).
  2. Submit any prompt.
  3. Observe: prompt is blocked, but no rejection reason is shown. The input box appears frozen.

Expected Behavior

The rejection reason ("This prompt was blocked by policy.") is displayed to the user, matching CLI behavior and the existing PostToolUse hook rendering.

Claude Code Version

_Latest as of filing_

Platform

Anthropic API

Operating System

macOS

Additional Information

Closing for stale activity on two separate issues without fixing an acknowledged bug creates a frustrating loop for users. This is a meaningful UX gap: when hooks are used for policy enforcement (e.g. managed enterprise deployments), users receive zero feedback on why their prompt was rejected. Please track this to resolution rather than auto-closing again.

Refs: #59822, #58269

View original on GitHub ↗

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