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

[BUG] Notification hook does not fire in VSCode extension

Open yoshiki0630 opened this issue 1 month ago • 12 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?

The Notification hook does not fire in the VSCode extension version of Claude Code.

Actual Behavior

  • Permission dialog is displayed as expected
  • However, the Notification hook does not fire
  • No log file is created by the hook command
  • PreToolUse and Stop hooks work correctly

What Should Happen?

Expected Behavior

According to the documentation (https://code.claude.com/docs/ja/hooks#notification), the Notification hook should fire in the following cases:

  • When Claude Code requests permission to use a tool
  • When the prompt input has been idle for at least 60 seconds

Error Messages/Logs

None

Steps to Reproduce

Steps to Reproduce

  1. Configure a Notification hook in settings.json with a command that logs to a file
  2. Reload VSCode window
  3. Configure permissions.ask to require confirmation for specific tools (e.g., Bash)
  4. Execute a tool that triggers the permission dialog

sample_settings.json

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.35 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

  • When the permission dialog was displayed, the Notification hook did not execute
  • The log file specified in the command was never created
  • Other hooks (PreToolUse, Stop) work as expected
  • Workaround: Using PreToolUse hook with matcher "Write|Edit|Bash|NotebookEdit" to achieve similar functionality
  • Unclear if this issue exists in the CLI version
  • This may be specific to the VSCode extension

yoshiki0630 avatar Nov 07 '25 00:11 yoshiki0630

I'm in the same situation and struggling as well. I'll include some information.

MacOS VSCode Version: 1.105.0 Claude Code Extention Version: 2.0.35

settings.json

{
  "permissions": {
    "allow": [
      "Bash(git:*)",
      "Bash(ls:*)",
      "Bash(cat:*)",
      "Bash(pwd:*)",
      "Bash(cd:*)",
      "Bash(find:*)",
      "Bash(grep:*)",
      "Bash(rg:*)",
      "Bash(npm:*)",
      "Bash(node:*)",
      "Bash(python:*)",
      "Bash(make:*)",
      "Bash(jq:*)",
      "Bash(curl:*)",
      "Bash(echo:*)",
      "Bash(gh:*)",
      "WebFetch(domain:github.com)",
      "WebFetch(domain:vercel.com)",
      "WebFetch(domain:docs.anthropic.com)",
      "WebFetch(domain:stackoverflow.com)",
      "WebFetch(domain:developer.mozilla.org)",
      "WebFetch(domain:npmjs.com)",
      "WebFetch(domain:nextjs.org)"
    ],
    "deny": [
      "Bash(sudo:*)",
      "Bash(rm:*)",
      "Bash(rm -rf:*)",
      "Bash(git push origin master)",
      "Bash(git push origin main)",
      "Bash(git reset:*)",
      "Bash(git rebase:*)",
      "Read(.env.*)",
      "Read(id_rsa)",
      "Read(id_ed25519)",
      "Read(**/*token*)",
      "Read(**/*key*)",
      "Write(.env*)",
      "Write(**/secrets/**)",
      "Bash(curl:*)",
      "Bash(wget:*)",
      "Bash(nc:*)",
      "Bash(npm uninstall:*)",
      "Bash(npm remove:*)",
      "Bash(psql:*)",
      "Bash(mysql:*)",
      "Bash(mongod:*)",
      "mcp__supabase__execute_sql"
    ],
    "defaultMode": "default"
  },
  "hooks": {
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e $'display notification \"タスク完了\" with title \"claude code\" sound name \"Glass\" \ntell application id \"com.microsoft.VSCode\" to activate'"
          }
        ]
      }
    ],
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e $'display notification \"claude > 確認事項があります!\" with title \"claude code\" sound name \"Glass\" \ntell application id \"com.microsoft.VSCode\" to activate'"
          }
        ]
      }
    ]
  },
  "statusLine": {
    "type": "command",
    "command": "npx ccusage@latest statusline"
  },
  "alwaysThinkingEnabled": true
}

Logs

2025-11-08 12:56:02.535 [info] From claude: [DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)
[DEBUG] executePreToolHooks called for tool: Bash
[DEBUG] Getting matching hook commands for PreToolUse with query: Bash
[DEBUG] Found 1 hook matchers in settings
[DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)

2025-11-08 12:56:02.984 [info] From claude: [DEBUG] Getting matching hook commands for PostToolUse with query: Bash
[DEBUG] Found 1 hook matchers in settings
[DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)

2025-11-08 12:56:02.996 [info] From claude: [DEBUG] Getting matching hook commands for PostToolUse with query: Bash
[DEBUG] Found 1 hook matchers in settings
[DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)

2025-11-08 12:56:02.998 [info] From claude: [DEBUG] Skills and commands included in Skill tool:
[DEBUG] Slash commands included in SlashCommand tool:

2025-11-08 12:56:03.654 [info] From claude: [DEBUG] Stream started - received first chunk

2025-11-08 12:56:03.689 [info] From claude: [DEBUG] Stream started - received first chunk

2025-11-08 12:56:04.560 [info] From claude: [DEBUG] Stream started - received first chunk

2025-11-08 12:56:06.056 [info] From claude: [DEBUG] executePreToolHooks called for tool: Bash
[DEBUG] Getting matching hook commands for PreToolUse with query: Bash
[DEBUG] Found 1 hook matchers in settings

2025-11-08 12:56:06.056 [info] From claude: [DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)

2025-11-08 12:56:06.068 [info] Received message from webview: {"type":"request","requestId":"7oa7jbx36oy","request":{"type":"show_notification","message":"Claude is requesting permission to use Bash","severity":"info","buttons":["View"],"onlyIfNotVisible":true}}

For privacy, the commands have been removed, but in reality the command contents are written. Image

In my case, it seems to have been resolved by updating VSCode to 1.105.1 and restarting. I’d like to monitor it a bit longer.

tatsuo48 avatar Nov 08 '25 04:11 tatsuo48

Confirming this on Win11 as well.

The Claude CLI does trigger the Notification hook, but the Claude Code extension does not.

OS Name Microsoft Windows 11 Pro Version 10.0.26100 Build 26100 VSCode Version: 1.105.0 Claude Code Extension Version: 2.0.35

Unfortunately updating to VSCode 1.105.1 and restarting ( VSCode, and the system ) did not resolve the problem.

memetican avatar Nov 08 '25 19:11 memetican

Thank you all for reporting this issue.

I also tested it with VSCode 1.105.1 in my environment, but the Notification hook did not work.

yoshiki0630 avatar Nov 10 '25 00:11 yoshiki0630

It also doesn't work for me. Please, someone fix this.

edsonbrusque avatar Nov 11 '25 13:11 edsonbrusque

i was very sad to learn about this bug. losing a lot of efficiency by having to watch Claude in case it asks me for something OR have it sit idle for some time because I'm doing something else and didn't notice

dappthatass avatar Nov 17 '25 23:11 dappthatass

me too!!!

cookiejoo avatar Nov 24 '25 11:11 cookiejoo

This is affecting me as well

noamt avatar Dec 02 '25 20:12 noamt

It would be great if this were fixed; it would also be great if there were an option to allow the VSCode extension to use VSCode's native notifications for Claude Code notifications.

glasser avatar Dec 08 '25 18:12 glasser

I have an alternative solution : Is Use Terminal !

Open Claude Code -> click 。。。 -> Configure Editor -> input:Use Terminal -> choose:Use Terminal

Image Image Image Image

cookiejoo avatar Dec 09 '25 03:12 cookiejoo

@cookiejoo This is not a solution. It's a workaround and a poor one.

The VS Code extension can do things the terminal doesn't, that's why we use it.

edsonbrusque avatar Dec 09 '25 15:12 edsonbrusque

@cookiejoo This is not a solution. It's a workaround and a poor one.

The VS Code extension can do things the terminal doesn't, that's why we use it.

I know, bro! It's just that when you need a hook to solve some indispensable problems, it's a choice you have to make. Hope the official will respond!

cookiejoo avatar Dec 09 '25 15:12 cookiejoo