[BUG] Grep tool causes "hook execution cancelled" errors that make Claude Code unusable

Status Fixed / completed
Maintainer reply ✓ Yes — dicksontsai
Activity 13 comments · opened Aug 23, 2025 · closed Aug 24, 2025
💡 Likely answer: A maintainer (dicksontsai, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Other: Claude Code CLI
  • Claude CLI version: 1.0.89 (Claude Code)
  • Operating System: macOS 15.6.1 (24G90)
  • Terminal: Terminal App (or iTerm2 - specify which you use)

## Bug Description
PostToolUse:Grep hook execution consistently gets cancelled, displaying "PostToolUse:Grep hook execution cancelled" error messages that interrupt and stop Claude sessions, making Claude Code unusable.

## Steps to Reproduce

  1. Start a Claude Code session
  2. Ask Claude to search for anything using the Grep tool
  3. Observe "PostToolUse:Grep hook execution cancelled" error appears
  4. Claude session gets interrupted/stopped

## Expected Behavior
Grep tool should execute successfully without hook cancellation errors, and Claude session should continue normally.

## Actual Behavior

  • "PostToolUse:Grep hook execution cancelled" error appears consistently
  • Error interrupts the Claude session
  • Makes Claude Code effectively unusable for any tasks requiring search functionality

## Additional Context

  • Issue persists even with completely disabled hooks ("hooks": {})
  • Reinstalling Claude Code does not resolve the issue
  • Multiple Claude processes were initially running, but killing all processes and clearing cache didn't fix it
  • Error appears to be a PostToolUse event handling bug rather than user configuration issue

Immediate workaround

  • Instruct Claude to use rg (ripgrep) via the Bash tool for all file searches instead of the Grep tool

<img width="600" height="380" alt="Image" src="https://github.com/user-attachments/assets/9b4e2265-ff6e-4741-bd64-00bacab7c738" />

View original on GitHub ↗

13 Comments

github-actions[bot] · 1 year ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4113
  2. https://github.com/anthropics/claude-code/issues/6305

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

Lyeeedar · 1 year ago

I'm experiencing this issue too. Yesterday suddenly Claude Code consistently fails to do anything as it constantly tries to call Grep then cancels itself

developervicky · 1 year ago

Yeah, right now I'm also facing this issue after using the claude code for some time.

Zyqoz · 1 year ago

I am also getting this issue.

cankaya05 · 1 year ago

I am also getting this issue too

JiminLee-way · 1 year ago

I am also getting this issue too.
window 11.24h2 26100.4946
Claude Code v1.0.89 opus (claude-opus-4-1-20250805)

osamamnagiub · 1 year ago

same issue

nextfridaydeveloper · 1 year ago

<img width="322" height="43" alt="Image" src="https://github.com/user-attachments/assets/01344862-198b-4dea-949e-1c2ea44f1b5c" />

I'm also getting this issue

kalibcrone · 1 year ago

Same issue started happening within the last day or so.

<img width="801" height="493" alt="Image" src="https://github.com/user-attachments/assets/697a9e9e-0e1f-43fe-82ba-1ee2ee37911d" />

kalibcrone · 1 year ago

I asked Claude to find a workaround to this issue.

If you ask Claude to search using the Task Tool, it it will work.

<img width="588" height="236" alt="Image" src="https://github.com/user-attachments/assets/8ee56095-5014-48ad-898d-4fd2f9103970" />

dicksontsai collaborator · 1 year ago

The hook system message is mis-triggering due to a cancellation in the Grep tool call itself. The Search tool itself is cancelling due to a stricter timeout. We are looking into this issue.

dicksontsai collaborator · 1 year ago

v1.0.90 (just released) should fix this issue.

github-actions[bot] · 12 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.