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

Resolved 💬 13 comments Opened Aug 23, 2025 by rdjxyz Closed Aug 24, 2025

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 ↗

This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗