Repository navigation
Description
Summary
When GitHub Copilot's read_file or list_dir tools receive an absolute path missing the drive colon — either Git Bash style (/c/path/to/file) or leading-backslash style (\c\path\to\file) instead of the correct Windows form (C:\path\to\file) — VS Code presents a user-facing "Allow reading external files?" or "Allow reading external directory?" security dialog. The file is inside the workspace. If the user allows the operation, it fails anyway because the path resolves incorrectly. The two tools also resolve the same malformed input via different internal code paths, producing different error messages.
This is the third of three related bugs in Copilot's search tools affecting multi-root workspaces on Windows. The principal issue is tracked in #293428.
Environment
- OS: Windows 11, integrated terminal using Git Bash
- VS Code: 1.109
- Workspace: Any (single-root or multi-root)
Reproduction
Setup
Any workspace containing a readable file, e.g.:
C:\projects\alpha\
src/
hello.txt
Steps
- Use
read_filewithfilePath: "C:\projects\alpha\src\hello.txt"— correct form, as baseline. - Use
read_filewithfilePath: "/c/projects/alpha/src/hello.txt"— Git Bash style. - Use
read_filewithfilePath: "\c\projects\alpha\src\hello.txt"— leading backslash, no drive colon. - Use
list_dirwithpath: "/c/projects/alpha/src". - Use
list_dirwithpath: "\c\projects\alpha\src".
Expected
Steps 2–5 should either resolve the path correctly to the workspace file, or fail immediately with a clear error indicating the path format is invalid. No user-facing security prompt should appear for files within the workspace.
Actual
- Step 1 (
C:\...): ✅ Works. - Step 2 (
/c/...,read_file): ❌ User sees "Allow reading external files?" dialog. The chat shows the mangled path\c\projects\alpha\src\hello.txt. After allowing: "Unable to resolve nonexistent file\c\projects\alpha\src\hello.txt". The file genuinely exists — only the path resolution is wrong. - Step 3 (
\c\...,read_file): ❌ Same dialog, same mangled display, same failure after approval. - Step 4 (
/c/...,list_dir): ❌ User sees "Allow reading external directory?" dialog. After allowing: "ENOENT: no such file or directory, scandirC:\c\projects\alpha\src" — the current driveC:\was prepended, producing a doubled path. - Step 5 (
\c\...,list_dir): ❌ Same dialog as Step 4. SameC:\c\projects\...resolution, same ENOENT.
Problems
1. Security prompt for workspace-internal files
Both malformed path formats cause VS Code to classify the target as "external" and present a security prompt, even though the target is inside the workspace. This interrupts the user for a request that will fail regardless.
2. Failure after user approval
Approving the security dialog does not help — the path still cannot be resolved. The prompt misleadingly implies the operation might succeed if allowed. Testing confirmed this with files that genuinely exist on disk at the correct C:\... path: the operation fails after approval, not because the file is missing, but because the internal path resolution never produces the correct drive-letter path.
3. Path display is mangled
When the chat UI displays the operation (e.g., "Reading hello.txt"), the path shown is \c\projects\alpha\src\hello.txt — backslashes without a drive colon. This is not a valid Windows path and is not the path the LLM requested (which may have been the Git Bash form /c/...).
4. Inconsistent internal resolution between tools
The two tools resolve the same malformed input differently:
| Malformed Input | read_file Resolution |
list_dir Resolution |
|---|---|---|
/c/projects/alpha/src/hello.txt |
file:///c/projects/... → fails |
C:\c\projects\... → ENOENT |
\c\projects\alpha\src\hello.txt |
file:///c/projects/... → fails |
C:\c\projects\... → ENOENT |
read_file converts to a file:/// URI lacking the drive letter (Windows requires file:///C:/...). list_dir prepends the current working drive, producing a doubled path. Both fail, but via different code paths with different error messages.
How Malformed Paths Arise
LLMs produce these paths in a predictable scenario:
- The user's integrated terminal is Git Bash, which displays paths as
/c/projects/.... - The LLM observes terminal output (e.g., from
pwdorfind) using this format. - The LLM adopts the format for subsequent
read_fileorlist_dircalls, not realizing these tools require Windows-native paths.
This is not an exotic edge case. Git Bash is the default Git shell on Windows and a common choice for VS Code's integrated terminal. The inline tools must handle Git Bash style paths on Windows.
Recommendation
- Detect and normalize. When a path matches the pattern
/x/...or\x\...on Windows (wherexis a single letter), the tool layer should recognize this as a drive-letter path and normalize it toX:\...before resolution. - Suppress the external-file prompt when the normalized path resolves to a location within the workspace.
- Unify path resolution between
read_fileandlist_dirso that the same input produces the same internal resolution and error behavior. - Display the path correctly in the chat UI, preserving the format the LLM used or normalizing to the correct Windows form — not a hybrid with backslashes but no drive colon.
Related Issues
- GitHub Copilot
grep_searchincludePatternsilently fails with workspace root folder name prefix in multi-root workspaces (severe) #293428 —grep_searchincludePatternsilently fails with workspace root folder name prefix in multi-root workspaces. - GitHub Copilot
file_searchglob with\**\(backslash double-star) produces partial or no results where/**/succeeds #293430 —file_searchglob with\**\produces partial or no results where/**/succeeds.
Activity
garretwilson commentedon Feb 5, 2026
This is a more severe manifestation of previous bugs such as #284697. But in this case the LLM was not at fault. I would bet that some new checks in v1.109 are naive and "they work fine on my Mac, so ship it"! 🙁
[-]Severe usability bug on Windows: Git Bash paths are flagged as out of the workspace[/-][+]Git Bash paths are flagged as out of the workspace on Windows[/+]garretwilson commentedon Feb 5, 2026
I've removed "severe" from the title as I haven't seen this again. (This would be severe if it were to happy regularly.) It may only happen when the file does not exist. Or it may have something to do with using an underpowered model (in this case Claude Haiku 4.5). I'll update when I have more information.
[-]Git Bash paths are flagged as out of the workspace on Windows[/-][+]Malformed absolute paths in `read_file` and `list_dir` trigger "Allow reading external files?" prompt, then fail on GitHub Copilot[/+]garretwilson commentedon Feb 6, 2026
roblourens, it turns out this is a significant issue after all. It is part of three crucial failures in GitHub Copilot VS Code workspace search tools. I have updated the ticket description accordingly. I'll include the text matrix below.
I have put in a lot of comprehensive investigative work on behalf of the GitHub Copilot Team. I would appreciate your attention to the related tickets #293428 (crucial), #293430, and #293204 (this one). Thank you.
garretwilson commentedon Feb 6, 2026
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).garretwilson commentedon Feb 6, 2026
Connor Peet (@connor4312) and roblourens , although I originally filed this ticket for a file that did not exist, further investigation shows that there are several scenarios that will cause this. In fact the updated description clearly says:
You closed this ticket as a duplicate of #292424, which only covers non-existing files.
I spent a long time doing comprehensive tests and providing a complete matrix with many scenarios. I would hate that you only address the "non-existent" scenario, ant that I would have to lose another entire morning filing more tickets (as I did this morning) after the next release.
Does the new ticket truly cover all the scenarios described here?
Does the GitHub Copilot team intend to put in place a comprehensive test suite to cover all these scenarios to make sure they are all addressed and to prevent regression?
connor4312 commentedon Feb 7, 2026
In your Step 2-5 cases, those should fail to resolve to a file on disk. So we should not present a warning dialog and just allow the tool to indicate failure to the model, just like we would for a valid path that doesn't exist. #292424 will cover this pretty well.
I suggest opening up a dedicated issue for the "Tool Path Resolution" stuff. That is related to search APIs which are their own world, we do varying degrees of normalization there which are unique from the simpler read file / dir listing tools.
garretwilson commentedon Feb 7, 2026
I'm not understanding. I put a lot of work into #293428, #293430, and #293204, which are significant lapses that severely impact LLM behavior and productivity. Are you saying they should be re-filed for a different team?
garretwilson commentedon Feb 7, 2026
Connor Peet (@connor4312) one thing I'm not sure is being emphasized here is that the tools fail under different conditions! If you don't think a path should work and want the tool to fail because of that, that's one thing. But shouldn't the tools fail in the same way for the same input paths? That's what I'm getting at with these three tickets.
The problem (and this is from real-world experience) is that the LLM is going to use some path format (for whatever reason), and it will work on one search tool, so it will use the same path format on another tool, and that other tool will provide really odd results, so the LLM will come up with all sorts of reasoning to try to make this inconsistency make sense (as would a human).
Figuring out that the tools have bugs that make them behave differently for the same paths is the last thing the LLM is going to think of (if ever; I had to really push the tool for it to figure that out) so instead the LLM will assume something else and muck up the project because it thought the search tools worked the same way and one tool gave it bad information that it took as true (because the same approach worked with other tools).
That's why I keep emphasizing: there needs to be a suite of tests for input paths across the search tools so that they will all work consistently. Really that's just standard practice and common sense.