Repository navigation
Description
Summary
In a multi-root workspace, GitHub Copilot's grep_search's includePattern does not recognize the workspace root folder name as a path prefix. The pattern rootname/path/to/file.ext silently returns zero results with a misleading error message, even though file_search finds the same file with the identical pattern.
This is the single largest source of LLM search failures in multi-root workspaces. Two additional lower-severity bugs discovered during this investigation are filed separately (see §Related Issues).
Environment
- OS: Windows 11 (likely affects all platforms — see §Recommended Test Suite)
- VS Code: 1.109
- Workspace: Multi-root (3 roots)
Reproduction
Setup
Create a multi-root workspace with two roots:
C:\projects\alpha\ ← workspace root "alpha"
src/
hello.txt ← contains "hello world"
C:\projects\beta\ ← workspace root "beta"
src/
hello.txt ← contains "goodbye world"
Steps
- Open both folders as a multi-root workspace.
- Use
grep_searchwithincludePattern: "alpha/src/hello.txt"andquery: "hello". - Use
file_searchwithquery: "alpha/src/hello.txt". - Use
grep_searchwithincludePattern: "src/hello.txt"andquery: "hello"(workaround).
Expected
Steps 2 and 3 both find C:\projects\alpha\src\hello.txt.
Actual
- Step 2 (
grep_search, root-prefixed): ❌ Returns no results. Error message: "Your search pattern might be excluded completely by either the search.exclude settings or .*ignore files." - Step 3 (
file_search, root-prefixed): ✅ Finds the file. - Step 4 (
grep_search, root-relative): ✅ Finds the file — but matches both roots, defeating the purpose of scoping.
The Discrepancy
includePattern / query |
file_search |
grep_search |
|---|---|---|
alpha/src/hello.txt (root-prefixed) |
✅ | ❌ |
alpha/**/hello.txt (root-prefixed glob) |
✅ | ❌ |
src/hello.txt (root-relative) |
✅ | ✅ |
**/hello.txt (recursive glob) |
✅ | ✅ |
The tools agree on root-relative and recursive patterns, but diverge on root-prefixed patterns. Slash direction (/ vs. \ vs. mixed) has no effect on this behavior — the results are identical in all slash variants.
Why This Is Critical for LLMs
-
Natural behavior leads to failure. LLMs use
file_searchto locate files, get back results, and learn thatrootname/pathis valid. They then pass the same root-prefixed path togrep_searchasincludePattern— which silently returns nothing. -
The error message misdirects. The LLM is told the file "might be excluded by
.gitignoreorsearch.exclude." This is false. The LLM then retries withincludeIgnoredFiles: true(doesn't help), and may eventually fall back to terminal commands, bypassing VS Code's search infrastructure entirely. -
No way to scope
grep_searchto a specific root. The only workaround is root-relative paths (e.g.,src/hello.txt), which match files in every root. In a multi-root workspace with similar directory structures, this produces unwanted cross-root results.
Confounding Factor: False Positives with **
The root-prefixed ** pattern (alpha/**/hello.txt) can appear to succeed if the root folder name coincidentally matches a directory segment inside the file tree (e.g., src/com/alpha/util/Hello.java contains a directory named alpha). The ** traverses to the coincidental match, not the root prefix. This creates false confidence in projects where the name coincidence exists, and silent failure in projects where it does not — making the bug appear intermittent when it is actually deterministic.
Root Cause Hypothesis
grep_search appears to delegate to a VS Code API that resolves includePattern globs strictly against paths relative to each workspace root's content directory. file_search appears to use a different API that additionally accepts the root folder name as a scope prefix. The two APIs have different multi-root path resolution semantics, but this distinction is not surfaced in the tool documentation.
Recommendation
grep_searchincludePatternshould accept root folder names as path prefixes, consistent withfile_search.- The error message when
includePatternmatches no files should not suggest.gitignoreorsearch.excludeunless those are actually responsible.
Related Issues
Two additional bugs discovered during this investigation:
- GitHub Copilot
file_searchglob with\**\(backslash double-star) produces partial or no results where/**/succeeds #293430 —file_searchglob\**\(backslash double-star) produces partial or no results where/**/succeeds. Lower severity; only affects Windows backslash glob patterns. - Malformed absolute paths in
read_fileandlist_dirtrigger "Allow reading external files?" prompt, then fail on GitHub Copilot #293204 — Malformed absolute paths (\c\pathor/c/path) trigger "Allow reading external files?" prompt, then fail. Affectsread_fileandlist_dir.
Recommended Test Suite
To prevent these discrepancies and catch regressions:
- Tool parity:
grep_searchandfile_searchproduce equivalent results for identical path patterns (root-relative, root-prefixed, recursive glob, explicit path). - Multi-root scoping: Root-prefixed paths correctly scope to the named root. Test with a root name that does not appear as any internal directory segment to avoid false positives.
- Error message accuracy: When
includePatternproduces no results due to an unrecognized path format, the message should not claim.gitignore/search.excludeexclusion. - Platform coverage: Run on Windows (cmd and Git Bash), macOS, and Linux.
Activity
[-]GitHub Copilot `grep_search` `includePattern` silently fails with workspace root folder name prefix in multi-root workspaces[/-][+]GitHub Copilot `grep_search` `includePattern` silently fails with workspace root folder name prefix in multi-root workspaces (severe)[/+]garretwilson commentedon Feb 6, 2026
The following test matrix should help you understand all the tests that were performed with which tools, and where the failures were.
(I hope that the GitHub Copilot team can put in place a comprehensive test suite so that all of these can be contested in a consistent an automated manner in the future, so it won't be left to users to run into them here and there—and sometimes not even understand that there is a bug, thinking that the LLM is just acting up.)
VS Code Search Tool Path Resolution — Comprehensive Test Matrix
Legend
Bug Key
grep_searchincludePatternsilently fails with workspace root folder name prefix in multi-root workspaces (severe) #293428 —grep_searchrejects root-name prefixfile_searchglob with\**\(backslash double-star) produces partial or no results where/**/succeeds #293430 —file_search\**\glob failureread_fileandlist_dirtrigger "Allow reading external files?" prompt, then fail on GitHub Copilot #293204 — malformed absolute paths trigger external-file promptPath Formats Tested
/src/main/App.java\src\main\App.javasrc\main/App.java/**/App.java\**\App.java/alpha/src/main/App.java\alpha\src\main\App.java/**/globalpha/**/App.java\**\globalpha\**\App.java\C:\projects\alpha\src\App.java/C:/projects/alpha/src/App.java/c/projects/alpha/src/App.java\, no colon\c\projects\alpha\src\App.javaResults
file_searchgrep_searchread_filelist_dir/\**/file/**\file\/\/**/glob\**\globC:\absoluteC:/absolute/c/Git Bash\c\no colonReading the Table
grep_searchcolumn): root-name prefix silently rejected.file_searchcolumn):\**\glob produces partial/no results.read_file/list_dircolumns): malformed absolute paths prompt then fail.read_file/list_dir;file_searchandgrep_searchdon't accept absolute paths (by design, not a bug).marcofraccaro commentedon Feb 9, 2026
Garret Wilson (@garretwilson) great catch, I'm facing the exact same issue.
It makes Github Copilot nearly unusable in multi-root workspaces, even more with new models that rely heavily on grep search and get confused by the failing searches and the inconsistencies you reported. I hope the copilot team can prioritize this ticket soon.
Have you found any workaround?
garretwilson commentedon Mar 8, 2026
This bug constantly hits me, even with instructions to the LLM about how to work around this VS Code GitHub Pilot bug. Just last night the LLM did a simple update of a project to bring it in line with a dependency update. It completely missed certain dependency references because of these bugs.
Matt Bierner (@mjbvz) , these are blatant bugs in the critical search tools. These bug reports are explicit, thorough, well researched, and presented in understandable, accessible form. Why are they being ignored?