◉CLAUDE LABJP
●CODE 2.1.319 — Claude Code now moves MCP tasks to the background automatically, and a denyInsteadOfPrompting setting denies calls that would wait on a prompt●FABLE 5.2 — Claude Fable 5.2 and its fast mode are on the Claude API (11/9). Mythos 5.2 is limited to verified organizations●SONNET 4.5 — Retires on the Claude API on 11/30, 20 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST — Opus 4.8 fast mode is deprecated and will be removed on 11/30. Migrate to Opus 5.5●NEW — I Put a Ten-Line Promise File at the To…●CODE 2.1.319 — Claude Code now moves MCP tasks to the background automatically, and a denyInsteadOfPrompting setting denies calls that would wait on a prompt●FABLE 5.2 — Claude Fable 5.2 and its fast mode are on the Claude API (11/9). Mythos 5.2 is limited to verified organizations●SONNET 4.5 — Retires on the Claude API on 11/30, 20 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST — Opus 4.8 fast mode is deprecated and will be removed on 11/30. Migrate to Opus 5.5●NEW — I Put a Ten-Line Promise File at the To…
Articles/Claude Code
⟐ Claude Code/2026-05-10Intermediate

Why Claude Code's Glob and Grep Return Zero Results

When Claude Code's Glob or Grep returns zero matches for files you can see, work through four boxes in order: ignore rules, hidden folders, pattern syntax, and the workspace boundary. Check the facts in your terminal first, then add one line to your opening prompt.

claude-code134troubleshooting105globgreptools

I still remember the night Glob came back empty on a search for TSX files. I dropped into the terminal, ran find . -name '*.tsx', and hundreds of paths scrolled past. The files were there, the pattern looked fine, and only Claude Code insisted there was nothing.

Moving between the web side of my wallpaper apps and the store-asset repositories, I hit this right after switching into any project where build output sits next to source. At first I kept rephrasing the same request to Claude three or four times. It didn't go well. A zero is not proof that the file is absent — it only says it wasn't visible under those conditions. Once I started treating it that way, the wasted rounds dropped sharply.

What I'd like to say up front: almost every case I've met fits into four boxes — ignore rules, hidden folders, pattern syntax, and the workspace boundary. I'll go through them in that order.

One caveat. How Glob and Grep treat ignored files can differ by version and settings. What follows is what I confirmed in my own setup; yours may differ. That's why the flow below leans on checking facts in the terminal before trusting what the tool says.

First, confirm in the terminal that the file exists

Before asking Claude again, spend ten seconds here.

# Does anything match the pattern at all?
find . -type f -name '*.tsx' | head -20
 
# Same check without node_modules
find . -type f -name '*.tsx' -not -path '*/node_modules/*' | head -20

If find shows files that Claude Code doesn't, the filesystem is innocent, and the suspects are the four boxes. If find also comes back empty, the mistake is in the path or the filename. That single fork settles half the investigation.

Box one: ignore rules hide the place

Locations your Git setup ignores can drop out of search.

  • Dependency sources under node_modules/
  • Build output in dist/ or build/
  • Caches such as .next/ or .turbo/
  • Environment files like .env.local

Grep runs on ripgrep underneath, so as I understand it .gitignore applies by default. For Glob, I'd avoid assuming the same behavior; I've seen the visible range differ with settings and versions.

When I genuinely want to look inside ignored places, I ask Claude to use Bash with explicit ripgrep flags.

# List everything, ignoring .gitignore and including hidden files
rg --hidden --no-ignore --files | grep -E '\.(tsx?|jsx?)$'
 
# Search a string with no ignore rules applied
rg --hidden --no-ignore -l 'useEffect' src/

I'm not aware of a switch on Glob that means "include ignored files," so I hand this kind of search to Bash from the start.

Box two: folders that start with a dot

A search for workflow files under .github/workflows/ once returned zero, and the cause wasn't .gitignore at all — the folder name starts with a dot. .vscode/ and .husky/ behave the same way. Because Git tracks them, it's easy to miss while you're busy suspecting ignore rules.

Adding rg --hidden usually clears this box.

Three reasons Grep misses a line you can see

The Grep tool is ripgrep underneath, and three habits of writing tripped me up.

Braces used as-is

When searching for Go's interface{} or chan struct{}, the braces are metacharacters.

# Unintended matches
rg 'interface{}' .
 
# Escape the braces
rg 'interface\{\}' .

I once lost about thirty minutes on chan struct{} in a Go project. Plain grep hadn't needed the escape, so I only noticed after running out of other explanations.

A multi-line pattern without multiline

Grep matches within a single line by default. A pattern running from struct { down to a field a few lines later returns zero unless multiline: true is passed. The moment I realize the match spans lines, I ask Claude to set that argument.

A type filter narrower than expected

type: 'js' refers to the JavaScript extension group; .ts and .tsx belong to a different one. When I want both, a brace-expanded glob reads less ambiguously.

# JS and TS together
rg 'pattern' --glob '*.{js,jsx,ts,tsx}'
 
# type works per extension group
rg 'pattern' --type ts

The same "small difference in how input is interpreted" shows up in the Edit tool's old_string not being unique, and the mental model carries over.

The mirror-image failure — too many hits hiding what you need — is written up in the first 250 lines of Grep output.

Box three: Glob pattern syntax

The combinations I mix up most often:

  • **/*.tsx: any depth, .tsx files
  • **/*.{ts,tsx}: brace expansion also works
  • src/**: everything under src, including the folders themselves
  • src/**/*: when you want files only
  • !**/test/**: negation — I don't rely on it in Glob alone; I narrow things down in Bash

I once wrote *.tsx meaning **/*.tsx, got only the root-level files back, and panicked that no components existed. The presence of **/ changes search depth directly.

Box four: the file is outside the working directory

Files outside the directory where the session started won't turn up in Glob or Grep. If you want Claude to consult another repository, allow it first with /add-dir.

  • Grant extra search roots with /add-dir <path>
  • Leave outside-the-boundary searches to find ~/another-project -name '*.ts' in Bash
  • Pass an absolute path to Read directly

I've written up the cross-repository flow in editing across repositories with --add-dir. Postpone the permission and ask Claude to "look at the implementation in that other repo," and you get a very confident zero.

How Read treats an absolute path outside the allowed roots varies with settings and version. It worked in my setup at times, but I don't reason "it can read it, so it can find it." I run /add-dir before searching, every time.

Still nothing: suspect the filesystem

Only when all four boxes are empty do I look at the filesystem itself, in this order.

# 1. Case (macOS is often case-insensitive)
ls -la src/Components 2>&1
ls -la src/components 2>&1
 
# 2. Broken symlinks
find . -type l ! -exec test -e {} \; -print
 
# 3. Invisible characters in filenames (NBSP, zero-width space)
ls src/ | cat -A
 
# 4. Does the file really exist?
stat src/components/Button.tsx

After I rebuilt a monorepo layout, links that pnpm install should have recreated were left behind as leftovers, and an evening disappeared. When I find broken links, deleting them and re-running pnpm install often resolves it. Still, this is the last box; most of my dead ends fit the first four.

The order I run in my head

When a search comes back empty, I check in this order. It takes about thirty seconds and beats rephrasing the same request by a wide margin.

First, find to confirm the file exists. Second, whether I'm looking in build output or dependencies — if so, I switch to Bash with rg --hidden --no-ignore. Third, whether a dot-folder is involved, or the pattern has a metacharacter or a missing **/. Last, whether I'm outside the workspace.

One opening line that prevents most of it

I add a few lines like these to the opening prompt of a session:

  • When ignored or hidden files matter, use rg --hidden --no-ignore via Bash
  • When another repository might be involved, suggest /add-dir first
  • When Glob returns zero, confirm with find before giving up

Handing over how to choose tools has been faster, in my experience, than hoping the model reaches for find on its own. Over the past year, rework from "I can't see that file" has nearly disappeared.

Deciding whether to use a dedicated tool or drop to Bash is itself a debugging skill, and I touched on that in when Bash commands don't behave as expected.

When you get a zero, run find once before you ask again. I keep that rule even on rushed days. Next time Glob comes back empty, I'd suggest trying rg --hidden --no-ignore --files | grep <your-pattern> just once.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

⟐ Claude Code2026-11-03
When Claude Code dies with a Bus error on a shared home directory, check this before you turn off auto-update
Why Claude Code crashes with a Bus error on an NFS-style shared home, how the official cleanup rule and update switches work, and two small scripts to check your setup.
⟐ Claude Code2026-05-24
When Claude Code's Sequential Edits Cascade into Failure — Fixing 'old_string not found' and 'not unique' on the Same File
Run several Edits against the same file and the second or third one suddenly fails with 'not found', 'not unique' or 'modified since read'. Here is how to tell the three apart, a small script that counts matches first, and the correct formatter hook setup.
⟐ Claude Code2026-05-10
When Claude Code's Read Doesn't Reach the End of a File — Catching the PARTIAL view Notice and Sizing offset/limit
When Read returns only part of a large file, Claude Code says so with a PARTIAL view notice. Here is how to catch it, and how to size offset and limit by byte budget rather than line count, with measurements from my own sandbox.