Hook Output Visibility Blocked in Claude Code UI
Bug Description
Bug Report for Anthropic
Product: Claude Code CLIVersion: 1.0.56Issue: Hook output not visible to users in Claude Code UI
Description
UserPromptSubmit and PreToolUse hooks cannot display output to users in the Claude Code interface, despite multiple implementation attempts following documented exit code behaviors.
Expected Behavior
According to documentation:
- Exit code 0: stdout shown in transcript mode (CTRL-R)
- Exit code 1 (or non-0/non-2): stderr shown to user
- Exit code 2: stderr fed to Claude
We expected exit code 1 to display our command header information to users.
Actual Behavior
No hook output is visible to users regardless of:
- Exit code used (tried 0, 1, others)
- Output stream used (stdout, stderr)
- Hook event type (UserPromptSubmit, PreToolUse)
- Output method (print, direct write, with/without flush)
What We Tried
Based on git history, we attempted:
- Multiple hook versions (command_visibility_hook.py, _v2.py, _v3.py, _blocking.py)
- Different hook events (UserPromptSubmit for slash commands, PreToolUse for Task tool)
- Various exit codes and output combinations
- Debug logging confirmed hooks executed but output never reached user
Impact
Cannot implement dynamic command context display via hooks. Had to abandon hook approach entirely and embed static headers directly in command markdown files.
Request
Please clarify how to make hook output visible to users in the main Claude Code interface, or document if this is not supported.
Environment Info
- Platform: darwin
- Terminal: WarpTerminal
- Version: 1.0.56
- Feedback ID: 1267db10-61f8-42dd-b9f1-419bf1e99c93
Errors
[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at checkExecSyncError (node:child_process:882:11)\n at execSync (node:child_process:954:15)\n at A7 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:797:5848)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:48013\n at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:609:14408)\n at fY (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:45724)\n at QK (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:44590)\n at SB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:50639)","timestamp":"2025-07-21T14:19:31.190Z"},{"error":"Error: ENOENT: no such file or directory, open '/proc/version'\n at Module.readFileSync (node:fs:443:20)\n at Object.readFileSync (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:615:7077)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:615:8638\n at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:609:14408)\n at kT4 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:709:62815)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-07-21T14:19:31.576Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/sean/.claude/config/hooks'\n at Module.readdirSync (node:fs:1581:26)\n at Object.readdirSync (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:615:7911)\n at vm6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1366:721)\n at Object.call (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1366:148)\n at call.next (<anonymous>)\n at fa6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2293:9807)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async OS1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2293:6470)\n at async ia (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:1318)\n at async xa6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2293:5615)","timestamp":"2025-07-21T14:20:41.743Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/sean/.claude/archive/config/hooks'\n at Module.readdirSync (node:fs:1581:26)\n at Object.readdirSync (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:615:7911)\n at vm6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1366:721)\n at Object.call (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1366:148)\n at call.next (<anonymous>)\n at fa6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2293:9807)\n at process.processTicksAndRejections (node:internal/process/task_queues:
Note: Error logs were truncated.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗