Grep tool count output_mode shows incorrect summary

Resolved 💬 3 comments Opened Jan 2, 2026 by jeduden Closed Jan 6, 2026

Description

When using the Grep tool with output_mode: "count", the tool correctly counts matches but the summary line incorrectly reports "Found 0 total occurrences across 0 files."

Reproduction Steps

  1. Have a file with known content (e.g., a markdown file with "Not Implemented" appearing 21 times)
  2. Use Grep with output_mode: "count":
Grep pattern="Not Implemented" path="/path/to/file.md" output_mode="count"
  1. Observe output:
21

Found 0 total occurrences across 0 files.

Expected Behavior

The summary should match the actual count:

21

Found 21 total occurrences across 1 file.

Actual Behavior

  • First line shows correct count: 21
  • Summary line incorrectly shows: Found 0 total occurrences across 0 files.

Additional Context

  • output_mode: "content" works correctly
  • output_mode: "files_with_matches" works correctly
  • Only output_mode: "count" has the inconsistent summary

Environment

  • Claude Code CLI
  • Model: claude-opus-4-5-20251101

View original on GitHub ↗

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