claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

File Search Returns No Results Despite Matching Content

Open rweijnen opened this issue 5 months ago • 7 comments

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."

rweijnen avatar Sep 09 '25 11:09 rweijnen

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/6250

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

github-actions[bot] avatar Sep 09 '25 11:09 github-actions[bot]

This is a different issue

rweijnen avatar Sep 09 '25 11:09 rweijnen

Is there a reason you're on a very old version of Claude Code (v1.0.69)? Maybe try upgrading first to the latest version?

Otherwise, there may be an issue with ripgrep. Try setting the env var USE_BUILTIN_RIPGREP=0 in your settings if you have already installed ripgrep separately.

dicksontsai avatar Sep 09 '25 19:09 dicksontsai

I see I have another issue as well... let me check if resolving that fixes this as wsell

claude --version
1.0.69 (Claude Code)

C:\Users\me>claude update
Current version: 1.0.69
Checking for updates...
Successfully updated from 1.0.69 to version 1.0.110

C:\Users\me>claude --version
1.0.69 (Claude Code)

rweijnen avatar Sep 10 '25 11:09 rweijnen

Your best bet might be to uninstall all existing versions of Claude Code and reinstall the latest Claude Code.

dicksontsai avatar Sep 10 '25 15:09 dicksontsai

I'm also experiencing this in claude 2.0.50 - I will have searches done like this:

Search(pattern: "**/pages/{Privacy,Terms,Cookies,PrivacyPolicy,TermsConditions,CookiesPolicy}*.vue", path: "~/git/app/resources/js")
⎿  Found 0 files 

But then a specific search like this works

Search(pattern: "**/Legal/**/*.vue", path: "~/git/app/resources/js")
  ⎿  Found 3 files (ctrl+o to expand)

Note: Privacy.vue, Terms.vue and Cookies.vue all exist in ~/git/app/resources/js/pages/Legal

Humni avatar Nov 23 '25 19:11 Humni

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 24 '25 10:12 github-actions[bot]