[BUG] Glob tool times out (20s) while equivalent ripgrep command completes in <1s

Resolved 💬 7 comments Opened Feb 1, 2026 by zoellner Closed Mar 24, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Bug Description

The Glob tool times out after 20 seconds on a monorepo with ~20 git submodules, even for simple patterns. However, the equivalent ripgrep command completes in under 1 second.

Steps to Reproduce

  1. Have a monorepo with multiple submodules (each with its own node_modules/)
  2. Run from monorepo root:

``
Glob(pattern="*/src/lib/uri.js")
``

Expected Behavior

Glob completes quickly, similar to raw ripgrep:

$ time rg --files -g '*/src/lib/uri.js'
subdmodule-1-api/src/lib/uri.js
submodule-2-api/src/lib/uri.js
# ... 12 files total
# 0.65s

Actual Behavior

Ripgrep search timed out after 20 seconds. The search may have matched files
but did not complete in time. Try searching a more specific path or pattern.

What Should Happen?

Glob completes quickly, similar to raw ripgrep:

$ time rg --files -g '*/src/lib/uri.js'
subdmodule-1-api/src/lib/uri.js
submodule-2-api/src/lib/uri.js
# ... 12 files total
# 0.65s

Error Messages/Logs

Steps to Reproduce

  1. Have a monorepo with multiple submodules (each with its own node_modules/)
  2. Run from monorepo root:

``
Glob(pattern="*/src/lib/uri.js")
``

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.29 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

Investigation Results

| Test | Result |
|------|--------|
| rg --files (respects .gitignore) | 6,703 files, 0.5s |
| rg --files --no-ignore | 1,312,657 files, 3.5s |
| rg --files -g '*/src/lib/uri.js' | 12 files, 0.65s |
| Glob(pattern="*/src/lib/uri.js") | Timeout 20s |
| Glob(pattern="...", path="/specific-submodule") | Works fine |
| Grep tool from same root | Works fine |

The .gitignore contains node_modules and ripgrep respects it. The Glob tool appears to either:

  1. Not pass the same flags to ripgrep
  2. Have additional processing overhead causing hangs
  3. Not respect .gitignore in the same way

Workaround

Specifying an explicit path parameter works:

Glob(pattern="**/uri.js", path="/path/to/specific-submodule")

Related Issues

  • #4486 - Hang with large ignored directory (auto-closed, not fixed)
  • #16043 - Glob silently fails when large .gitignore'd directories cause ripgrep timeout (closed as dup of #4486)
  • #14566 - @ mention file search excludes git submodules (similar but different feature)

Additional Context

  • Each submodule has 500-650MB node_modules
  • Total ~20 submodules
  • The deprecated ignorePatterns setting no longer exists in the schema
  • respectGitignore defaults to true and ripgrep confirms .gitignore is being respected

View original on GitHub ↗

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