File Search Returns No Results Despite Matching Content

Resolved 💬 12 comments Opened Sep 9, 2025 by rweijnen Closed Mar 23, 2026

Bug: Search function fails to find text that exists in file

Environment

  • Claude Code version: v1.0.69
  • OS: Windows

Impact

This bug makes the Search function unreliable for finding text in files, forcing users to fall back to external tools like grep.

Description

The built-in Search function is not finding text that clearly exists in files. When searching for the word "morbi" in a test file, the Search function returns 0 results, but using grep on the same file successfully finds the text.

Steps to Reproduce

  1. Create a file test.txt with the following content:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna.
Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci.
Aenean nec lorem. In porttitor. Donec laoreet nonummy augue.
Suspendisse dui purus, scelerisque at, vulputate vitae, pretium mattis, nunc. Mauris eget neque at sem venenatis eleifend. Ut nonummy.
  1. Use the Search function: Search(pattern: "morbi", path: "test.txt", output_mode: "content")
  2. Observe that it returns "Found 0 lines"
  3. Use grep on the same file: grep "morbi" test.txt
  4. Observe that grep successfully finds the text on line 3

Expected Behavior

The Search function should find and return line 3 containing "morbi" just like grep does.

Actual Behavior

The Search function returns 0 results despite the text being present in the file.

Evidence

● I've created a CLAUDE.md file for your repository. Since this is a minimal test repository with only a single
  text file containing Lorem ipsum content, the documentation is correspondingly brief. The file provides context
  about the repository's purpose and structure for future Claude Code instances.

> does the word morbi occur in test.txt ?

● Search(pattern: "morbi", path: "test.txt", output_mode: "content")
  ⎿  Found 0 lines

● Search(pattern: "morbi", path: "test.txt", output_mode: "content")
  ⎿  Found 0 lines

● No, the word "morbi" does not occur in test.txt.

> now try with grep

● Bash(grep "morbi" "C:\Users\me\source\repos\scripts\search-test\test.txt")
  ⎿ Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra no
    nummy pede. Mauris et orci.


● Yes, the word "morbi" does occur in test.txt. It appears in line 3: "Pellentesque habitant morbi tristique
  senectus et netus et malesuada fames ac turpis egestas."

View original on GitHub ↗

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