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

[BUG] User-level stop hook does not trigger when claude is run from home dir

Open brson opened this issue 3 weeks ago • 1 comments

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 trying to set up a Stop hook, I was doing my testing from the home dir and failed repeatedly. Once I ran Claude Code from a project dir it worked as expected.

Here's what I saw.

My ~/.claude/settings.json:

{
  "alwaysThinkingEnabled": true,
  "feedbackSurveyState": {
    "lastShownTime": 1753988274802
  },
  "hooks": {
    "Stop": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "/home/brian/.homes/dev/.local/bin/claude-signal-notify"
          }
        ]
      }
    ]
  }
}

When running from ~ I see that /hooks suspiciously reports 2 hooks:

 Hooks
 2 hooks

 ❯ 1.  PreToolUse - Before tool execution
   2.  PostToolUse - After tool execution
   3.  PostToolUseFailure - After tool execution fails
   4.  Notification - When notifications are sent
 ↓ 5.  UserPromptSubmit - When the user submits a prompt

 Enter to confirm · Esc to cancel

Digging into the Stop hooks:

 Stop
 Exit code 0 - stdout/stderr not shown
 Exit code 2 - show stderr to model and continue conversation
 Other exit codes - show stderr to user only

 ❯ 1. + Add new hook…                                         User Settings
   2. /home/brian/.homes/dev/.local/bin/claude-signal-notify  Project Settings
   3. /home/brian/.homes/dev/.local/bin/claude-signal-notify

Claude thinks there are project hooks and other hooks at identical paths.

The hook never triggers.

What Should Happen?

Some kind of deduplication to de-confuse Claude and trigger the hooks.

Error Messages/Logs


Steps to Reproduce

Use the supplied settings.json and run Claude from the home dir.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.76

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

No response

brson avatar Dec 29 '25 00:12 brson