claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Persistent Hook Warning Messages in UI After Issue Resolution

Open Shadyman opened this issue 5 months ago • 2 comments

Bug Description

Hook warning messages persist in the Claude Code UI even after the underlying issue has been resolved. The warning appears in bold and remains visible across session resumes, causing UI clutter and confusion about hook status.

Error Format: SessionStart:compact [command] failed with non-blocking status code 1: [error details]

Environment

  • Version: 1.0.98
  • Platform: Linux
  • Terminal: vscode
  • Feedback ID: e890dea3-5378-4c82-8928-a79bd79a3dbb

Steps to Reproduce

  1. Configure a SessionStart hook that fails with non-zero exit code (e.g., database constraint violation)
  2. Start a Claude Code session - hook fails and displays warning in UI
  3. Fix the underlying issue (e.g., add ON CONFLICT DO NOTHING to database operations)
  4. Resume the same conversation or start new sessions
  5. Notice the original warning message still appears in bold in the UI

Expected Behavior

  • Resolved hook warnings should be dismissible from the UI
  • Successfully running hooks should clear previous warnings for the same hook
  • Users should have a way to acknowledge and dismiss resolved warnings

Actual Behavior

  • Hook warning messages persist indefinitely in the conversation UI
  • Warning appears in bold as SessionStart:compact [command] failed with non-blocking status code 1
  • /doctor command does not clear conversation-specific warnings
  • Only way to clear is to start a completely new conversation

Technical Details

Root Cause: Warning messages are stored permanently in conversation JSONL files as system messages with "level": "warning". Even after fixing the underlying hook issue, the historical warning persists in the UI because there's no mechanism to dismiss resolved warnings.

Key Characteristics:

  • Conversation-specific (tied to UUID, not global state)
  • Survives session resumes, context compactions, and /doctor runs
  • New conversations work fine; only affects conversations with historical warnings (See EDIT Below)
  • Hook now executes successfully, but UI still shows old error

EDIT: Any /resume performed within the TUI maintains the error at the bottom even if the resumed conversation is unrelated. A new session with /clear or with claude from the command line still removes the error, though.

Suggested Solutions

Option 1: UI Dismiss Button (Recommended)

Add an "X" or "Dismiss" option for resolved hook warnings

  • Pros: Simple user control, maintains conversation history
  • Cons: Requires UI changes, user action needed
  • Implementation: Add dismiss state to warning message storage

Option 2: Auto-Clear on Success

Clear previous warnings when the same hook runs successfully

  • Pros: Automatic resolution, no user action required
  • Cons: May hide useful debugging history
  • Implementation: Track hook success/failure states per hook type

Option 3: Warning Management Tools

Provide conversation-level tools to manage hook warnings

  • Pros: Fine-grained control, power user features
  • Cons: Added complexity, discoverability issues
  • Implementation: Add warning management to conversation settings

Additional Context

Novel Issue: Based on repository search, this appears to be the first reported case of persistent hook warning UI behavior.

Impact: While hooks continue to function correctly, users experience workflow disruption and confusion about hook status, potentially leading to unnecessary conversation restarts.

Shadyman avatar Aug 31 '25 18:08 Shadyman

When this happens with hooks, the warnings end up accumulating and preventing any output from being seen. This makes claude unusable.

kyanha avatar Sep 16 '25 02:09 kyanha

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 05 '25 10:12 github-actions[bot]