[BUG] UserPromptSubmit hook doesn't display stderr output on non-zero exit code

Resolved 💬 6 comments Opened Nov 4, 2025 by amcdavid Closed Feb 10, 2026

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?

According to the online documentation (via /hooks), when a hook exits with code neither 0 nor 2, its stderr should display messages to the user:

UserPromptSubmit Input to command is JSON with original user prompt text. Exit code 0 - stdout shown to Claude Exit code 2 - block processing, erase original prompt, and show stderr to user only Other exit codes - show stderr to user only

However, when I write a script that attempts to use this, I see " ⎿  UserPromptSubmit hook error" in the claude terminal after each user prompt submit.

If I change the exit code 0, and send the output to stdout, then claude sees the message as part of its "System reminder"

This was working with an legacy-style hook that just emitted to standard out as of 31 October, and broke over the weekend, I guess; whenever all the updates to the hooks shipped.

What Should Happen?

When a UserPromptSubmit hook command:

Writes a message to stderr
Exits neither 0 nor 2;
it should display in the claude cli console, per documentation.

Error Messages/Logs

⎿  UserPromptSubmit hook error

Steps to Reproduce

  1. Create tools/test-hook.sh with
#!/bin/bash
echo "Here's a message for the user" >&2
exit 1
  1. chmod +x tools/test-hook.sh
  2. Replace .claude/settings.json with
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "match": ".*",
        "hooks": [
          {
            "type": "command",
            "command": "tools/test-hook.sh"
          }
        ]
      }
    ]
  }
}

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Whatever was current on 31 October 2025

Claude Code Version

2.0.32 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗