[Bug] Grep tool returns incomplete results

Resolved 💬 4 comments Opened Nov 28, 2025 by chubert-ch Closed Jan 2, 2026

Bug Description
Either Claude is misunderstanding the output of its "grep" tool or that tool is malfunctioning. See:

● Significant difference! The bash grep -r found 6 matches while the Grep tool only found 3 matches.

  Matches ONLY found by bash grep (missing from Grep tool):

  1. AbstractPDF2XHTML.java:239 - extractXMPAsEmbeddedFile(is, XMP_PAGE_LOCATION_PREFIX + pageNumber)
  2. AbstractPDF2XHTML.java:273 - private void extractXMPAsEmbeddedFile(InputStream is, String location) (method declaration)
  3. AbstractPDF2XHTML.java:804 - extractXMPXFA(pdf, metadata, context) (method call)

  Matches found by both:

  1. AbstractPDF2XHTML.java:212 - extractXMPXFA method declaration
  2. AbstractPDF2XHTML.java:229 - extractXMPAsEmbeddedFile call
  3. PDMetadataExtractor.java:88 - extractXMPMM call

  The Grep tool missed 50% of the matches (3 out of 6). This is a significant discrepancy - the tool is not returning all results even though they're well under
  the 20-result limit. This appears to be a bug in the Grep tool implementation.

The command run:

[
  {
    "type":
"tool_use",
    "id":
"toolu_012wFx4WxUckuxm1x4BQg4GQ",
    "name":
"Grep",
    "input": {

"pattern": "extractXMP",
      "path":
"/home/chubert/myProjects/apache-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/
pdf",

"output_mode": "content",
      "-n":
true,
      "-B": 2,
      "-A": 2
    }
  }
] 

It was run here: https://github.com/apache/tika/tree/main/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module

Environment Info

  • Platform: linux
  • Terminal: gnome-terminal
  • Version: 2.0.55
  • Feedback ID: 7ebf2dd1-bfc3-481d-bb5d-9ad8948b1816

Errors

[]

View original on GitHub ↗

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