You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Copilot Agent file tools fail with WSL path mismatch #289166
Does this issue occur when all extensions are disabled?: No (requires GitHub Copilot extension)
VS Code Version: 1.108.1
OS Version: Windows 11 + WSL2 (Ubuntu)
GitHub Copilot: 1.388.0
GitHub Copilot Chat: 0.36.1
Steps to Reproduce:
Open a WSL workspace in VS Code by running cd /home/user/project && code . from a WSL terminal
Start a Copilot Agent session (Copilot Chat in Agent mode)
Ask Copilot Agent to read or edit a file in the workspace
Observe that grep_search tool works and returns paths like \home\user\project\file.md
Observe that read_file and replace_string_in_file tools fail with "File is outside of the workspace" error for the same files
Expected: File tools should accept WSL paths and work consistently with search tools
Actual: Path format mismatch - search tools return Windows-style paths (\home\...) but file tools reject both Unix (/home/...) and Windows (\home\...) formats as "outside of workspace"
Workaround: Use terminal commands (cat, sed -i) instead, but this bypasses VS Code's diff view and user approval workflow for file changes.
Similar code found with 1 license type - View matches
Just to confirm, you are using the WSL extension, right? The VS Code window that opens is a remote WSL window (as indicated by WSL in the lower left corner).
Additional context:
- This project was originally developed on a different machine with a different path
- I then cloned/copied it to this machine at a new path
- Other projects in the SAME WSL (e.g. ~/projects/wingmen) work fine
- I have tried:
- Deleting ~/.vscode-server/data/User/workspaceStorage/*
- Deleting and reinstalling Copilot extensions
- Reloading VS Code window
- None of these fixed the issue
Could VS Code/Copilot be caching workspace identity based on something
other than the current path (e.g. git remote URL, some hidden file,
or inode)?
From: Kasper Elsborg ***@***.***>
Sent: Wednesday, 21 January 2026 20.02
To: 'microsoft/vscode' ***@***.***>; 'microsoft/vscode' ***@***.***>
Cc: 'Author' ***@***.***>
Subject: RE: [microsoft/vscode] Copilot Agent file tools fail with WSL path mismatch (Issue #289166)
Hi
Yes, I am using WSL:
- WSL_DISTRO_NAME: Ubuntu
- Linux version: 6.6.87.2-microsoft-standard-WSL2
- VS Code shows "WSL: Ubuntu" in lower left corner ✅
- VS Code server runs in WSL: ~/.vscode-server/extensions/github.copilot*
The Copilot extension IS running on WSL side (not UI side):
- Extension path: ~/.vscode-server/extensions/github.copilot-1.388.0
About grep_search paths - here's exact output from my session:
When I call grep_search, Copilot returns paths like:
\\home\\kasper\\projects\\private\\IronKeyVault\\CLAUDE.md <file://home/kasper/projects/private/IronKeyVault/CLAUDE.md>
But when I call read_file with either:
- /home/kasper/projects/private/IronKeyVault/CLAUDE.md
- \\home\\kasper\\projects\\private\\IronKeyVault\\CLAUDE.md <file://home/kasper/projects/private/IronKeyVault/CLAUDE.md>
Both fail with "File is outside of the workspace"
Important: This ONLY happens in ONE specific project folder.
Other WSL projects in ~/projects/wingmen work fine with read_file.
Could there be cached workspace state causing path mismatch for this specific folder?
From: Martin Aeschlimann ***@***.*** ***@***.***> >
Sent: Wednesday, 21 January 2026 16.13
To: microsoft/vscode ***@***.*** ***@***.***> >
Cc: Aziki ***@***.*** ***@***.***> >; Author ***@***.*** ***@***.***> >
Subject: Re: [microsoft/vscode] Copilot Agent file tools fail with WSL path mismatch (Issue #289166)
<https://avatars.githubusercontent.com/u/6461412?s=20&v=4> aeschli left a comment (microsoft/vscode#289166) <#289166 (comment)>
Just to confirm, you are using the WSL extension, right? The VS Code window that opens is a remote WSL window (as indicated by WSL in the lower left corner).
When I test this I don't see grep_search returning paths like \home\user\project\file.md
Can you make a sample request and set the response log?
https://github.com/microsoft/vscode/wiki/Copilot-Issues#language-model-requests-and-responses
—
Reply to this email directly, view it on GitHub <#289166 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKABAQIDIJ2ZUBPMZIC7ZDD4H6JQRAVCNFSM6AAAAACSJZ3PE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTONZYGY4TIOBYGM> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/AKABAQIKDAENCKBAHWOVGO34H6JQRA5CNFSM6AAAAACSJZ3PE2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTXBHJHOG.gif> Message ID: ***@***.*** ***@***.***> >
bchen36 (@bryanchen) You have worked on grep_search tool? It should not return paths with backslash when running on WSL. Aziki (@IronKeyVault) You did not configure the vscode-copilot-chat extension to run on the UI side, right?
No custom extensionKind configuration in settings.json
The issue is that grep_search returns backslash paths (Windows-style), but read_file/replace_string_in_file
reject them as "outside of workspace" because they expect forward slash paths (Unix-style) on WSL.
IMPORTANT: The issue only occurs in THIS specific project after we moved the installation location.
Timeline:
Edit tools worked before moving project location
After moving to /home/kasper/projects/private/IronKeyVault - edit tools stopped working
grep_search works (returns \home\kasper\... paths)
read_file/replace_string_in_file fail with "outside of workspace"
Other projects: Edit tools work fine ✅
This project only: Edit tools broken ❌
Current path: /home/kasper/projects/private/IronKeyVault
Mounted on: /dev/sdd (native WSL2 filesystem, not /mnt/c/)
Hypothesis: Something about the path "/home/kasper/projects/private/IronKeyVault" causes
path mapping mismatch between grep_search (returns backslash) and read_file (expects forward slash).
Question: Is there a VS Code workspace cache or path mapping cache that needs to be cleared
after moving a project location?
There's no cache on workspace folders. What exactly are the URIs of the workspace folders? The request log would show that somewhere in the prompt. It would great if you could provide the request log (copilotmd file) of a simple call and attach it here maybe you can erase all confidential information
Here's the request log showing the path transformation issue:
Logs taken from ctrl+shift u -> github copilot chat:output
2026-01-24 05:58:23.707 [error] Error from tool read_file with args
{"filePath": "/home/kasper/projects/private/IronKeyVault/README.md", "startLine": 1, "endLine": 5}:
File \home\kasper\projects\private\IronKeyVault\README.md is outside of the workspace...
at aIe (c:\Users\KasperElsborg.vscode\extensions\github.copilot-chat-0.36.2\dist\extension.js:1257:37953)
at async Hfe.prepareInvocation (...)
Copilot Agent'sread_fileandreplace_string_in_filetools fail on all Unix-based remote connections (WSL, SSH). The tools reject valid file paths as "outside of workspace" or "file does not exist".
Root Cause
uriToFsPath()in VS Code core converts Unix paths (/home/user/...) to invalid Windows paths (\home\user\...) regardless of the actual filesystem.
Key Finding: State-Dependent Behavior
File State | read_file | replace_string_in_file
-- | -- | --
Pre-existing in workspace | ❌ FAILS | ❌ FAILS
Created via create_file tool | ✅ WORKS | ✅ WORKS
Files created fresh via Copilot'screate_filetool work correctly. Pre-existing files have corrupted path mappings in VS Code's internal cache.
Affected Tools
❌read_file- broken on pre-existing files
❌replace_string_in_file- broken on pre-existing files
✅grep_search- works
✅run_in_terminal- works
✅create_file- works
Workaround
Delete file via terminal, recreate viacreate_filetool. Impractical for routine use.
Bug Report: Copilot Agent file tools fail with Unix path conversion on Remote SSH
Environment
Component
Version
VS Code
1.108.1
GitHub Copilot
1.388.0
GitHub Copilot Chat
0.36.2
Host OS
Windows 11
Remote
Rocky Linux 9 via Remote-SSH
Problem Summary
Copilot Agent's read_file and replace_string_in_file tools fail on all existing files when connected via Remote-SSH (or WSL). The tools receive valid Unix paths but VS Code converts them to invalid Windows-style backslash paths internally.
Minimal Reproduction Steps
Setup
Connect VS Code to a Linux remote via Remote-SSH (or WSL)
Create a test file:
mkdir -p /tmp/copilot-bug-repro
echo"Test content line 1"> /tmp/copilot-bug-repro/test.md
echo"Test content line 2">> /tmp/copilot-bug-repro/test.md
Open the folder in VS Code: code /tmp/copilot-bug-repro
Reproduce
Open Copilot Chat (Agent mode)
Type: Read the file /tmp/copilot-bug-repro/test.md
Observe the error
Expected Result
File content is returned successfully.
Actual Result
ERROR: cannot open file:///tmp/copilot-bug-repro/test.md
Detail: Unable to read file '\tmp\copilot-bug-repro\test.md'
(Error: Unable to resolve nonexistent file '\tmp\copilot-bug-repro\test.md')
Root Cause Analysis
The tool receives the correct Unix path:
/tmp/copilot-bug-repro/test.md
But the error shows a Windows-style backslash path:
\tmp\copilot-bug-repro\test.md
The bug appears to be in uriToFsPath() in VS Code's URI handling:
// In uri.tsif(isWindows){value=value.replace(/\//g,'\\');}
This code runs because the VS Code host is Windows, but it incorrectly converts Unix paths from the remote filesystem.
Tool Status Matrix
Tool
Status
Notes
grep_search
✅ Works
semantic_search
✅ Works
file_search
✅ Works
run_in_terminal
✅ Works
create_file
✅ Works
New files work correctly
read_file
❌ FAILS
"Unable to resolve nonexistent file"
replace_string_in_file
❌ FAILS
Same error
list_dir
❌ FAILS
Same error
Key Observation
Files created via create_file tool work correctly with read_file and replace_string_in_file. Only pre-existing files fail. This suggests the tool registration uses correct paths for newly created files but has corrupted path mappings for existing workspace files.
Window Output Log (Key Error)
2026-01-29 09:05:29.787 [error] [Window] [LanguageModelToolsService#invokeTool] Error from tool copilot_readFile with parameters {"filePath":"/home/kasperadm/IronKeyVault/CLAUDE.md","startLine":1,"endLine":200}:
cannot open file:///home/kasperadm/IronKeyVault/CLAUDE.md. Detail: Unable to read file '\home\kasperadm\IronKeyVault\CLAUDE.md' (Error: Unable to resolve nonexistent file '\home\kasperadm\IronKeyVault\CLAUDE.md')
at sUe.$tryOpenDocument (vscode-file://vscode-app/c:/Users/kasper/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:542:8532)
All show same pattern: Unix path input → backslash path in error.
Proposed Fix
In uri.tsuriToFsPath() function, detect and preserve Unix paths:
// Beforeif(isWindows){value=value.replace(/\//g,'\\');}// After - don't convert Unix paths on Windows hostif(isWindows&&!value.startsWith('/')){value=value.replace(/\//g,'\\');}
Impact
This bug makes Copilot Agent's file editing capabilities completely non-functional for:
Remote-SSH connections from Windows to Linux
WSL workspaces
Any scenario where Windows VS Code accesses Unix filesystems
The fix should check the path origin, not just host OS:
// Current (problematic)if(isWindows){value=value.replace(/\//g,'\\');}// Proposed fixif(isWindows&&!value.startsWith('/')){value=value.replace(/\//g,'\\');}
Paths starting with / are definitionally Unix paths and should never be converted to backslashes, regardless of which OS the extension runs on.
By default it should be running on the WSL side. Aziki (@IronKeyVault) can you open command center (ctrl+shift+P) and run command "Show running extensions", in the Running Extensions window, check if the Github copilot chat extension is running from WSL?
Bryan Chen (@bryanchen-d) you you are right. it runs on the remote side. I tried to spin up a linux rocky on a vm, to see if it made a difference. but no the issue is still here.
<environment_info>
The user's current OS is: Windows
</environment_info>
<workspace_info>
I am working in a workspace with the following folders:
- \\home\\kasperadm\\IronKeyVault
When I run on WSL it says:
<environment_info>
The user's current OS is: Linux
</environment_info>
<workspace_info>
I am working in a workspace with the following folders:
- /home/aeschli/workspaces/testing/prompt
The OS we get from the node.process.
It would mean that your Copilot Chat extension runs on the UI side, or you are not in a remote WSL setup.
Best is to remove the entire remote.extensionKind section from your settings and use the defaults. This is a advanced setting and not all extensions can be configured like that.
Activity
chrmarti commentedon Jan 21, 2026
Are you running the extension on the UI side? (It needs to be run in WSL as a workspace extension, maybe you changed this in your user settings.)
aeschli commentedon Jan 21, 2026
Just to confirm, you are using the WSL extension, right? The VS Code window that opens is a remote WSL window (as indicated by WSL in the lower left corner).
When I test this I don't see grep_search returning paths like \home\user\project\file.md
Can you make a sample request and set the response log?
https://github.com/microsoft/vscode/wiki/Copilot-Issues#language-model-requests-and-responses
IronKeyVault commentedon Jan 21, 2026
IronKeyVault commentedon Jan 21, 2026
aeschli commentedon Jan 22, 2026
bchen36 (@bryanchen) You have worked on grep_search tool? It should not return paths with backslash when running on WSL.
Aziki (@IronKeyVault) You did not configure the vscode-copilot-chat extension to run on the UI side, right?
IronKeyVault commentedon Jan 23, 2026
bchen36 (@bryanchen)
YES - grep_search tool returns paths with backslash on WSL:
Example: \home\kasper\projects\private\IronKeyVault\...
Expected: /home/kasper/projects/private/IronKeyVault/...
NO - I did not manually configure vscode-copilot-chat extension to run on UI side.
Using default settings:
The issue is that grep_search returns backslash paths (Windows-style), but read_file/replace_string_in_file
reject them as "outside of workspace" because they expect forward slash paths (Unix-style) on WSL.
IronKeyVault commentedon Jan 23, 2026
IMPORTANT: The issue only occurs in THIS specific project after we moved the installation location.
Timeline:
Other projects: Edit tools work fine ✅
This project only: Edit tools broken ❌
Current path: /home/kasper/projects/private/IronKeyVault
Mounted on: /dev/sdd (native WSL2 filesystem, not /mnt/c/)
Hypothesis: Something about the path "/home/kasper/projects/private/IronKeyVault" causes
path mapping mismatch between grep_search (returns backslash) and read_file (expects forward slash).
Question: Is there a VS Code workspace cache or path mapping cache that needs to be cleared
after moving a project location?
IronKeyVault commentedon Jan 23, 2026
UPDATE: Tried clearing workspace cache and reopening - issue persists.
Steps attempted:
code .Result: Edit tools still fail with "outside of workspace"
This confirms it's a persistent bug related to this specific project path
(/home/kasper/projects/private/IronKeyVault), not a cache issue.
The bug is reproducible after project relocation and survives workspace cache clearing.
aeschli commentedon Jan 23, 2026
There's no cache on workspace folders. What exactly are the URIs of the workspace folders? The request log would show that somewhere in the prompt. It would great if you could provide the request log (copilotmd file) of a simple call and attach it here maybe you can erase all confidential information
IronKeyVault commentedon Jan 24, 2026
Thanks for looking into this!
Here's the request log showing the path transformation issue:
Logs taken from ctrl+shift u -> github copilot chat:output
2026-01-24 05:58:23.707 [error] Error from tool read_file with args
{"filePath": "/home/kasper/projects/private/IronKeyVault/README.md", "startLine": 1, "endLine": 5}:
File \home\kasper\projects\private\IronKeyVault\README.md is outside of the workspace...
at aIe (c:\Users\KasperElsborg.vscode\extensions\github.copilot-chat-0.36.2\dist\extension.js:1257:37953)
at async Hfe.prepareInvocation (...)
3 remaining items
IronKeyVault commentedon Jan 28, 2026
I had copilot summon up the issue her.
Environment
Bug Description
Copilot Agent's
read_fileandreplace_string_in_filetools fail on all Unix-based remote connections (WSL, SSH). The tools reject valid file paths as "outside of workspace" or "file does not exist".Root Cause
uriToFsPath()in VS Code core converts Unix paths (/home/user/...) to invalid Windows paths (\home\user\...) regardless of the actual filesystem.Key Finding: State-Dependent Behavior
File State | read_file | replace_string_in_file -- | -- | -- Pre-existing in workspace | ❌ FAILS | ❌ FAILS Created via create_file tool | ✅ WORKS | ✅ WORKSFiles created fresh via Copilot's
create_filetool work correctly. Pre-existing files have corrupted path mappings in VS Code's internal cache.Affected Tools
read_file- broken on pre-existing filesreplace_string_in_file- broken on pre-existing filesgrep_search- worksrun_in_terminal- workscreate_file- worksWorkaround
Delete file via terminal, recreate via
create_filetool. Impractical for routine use.aeschli commentedon Jan 29, 2026
Please make a small reproducible example that provide us the request log: https://github.com/microsoft/vscode/wiki/Copilot-Issues#language-model-requests-and-responses
IronKeyVault commentedon Jan 30, 2026
Bug Report: Copilot Agent file tools fail with Unix path conversion on Remote SSH
Environment
Problem Summary
Copilot Agent's
read_fileandreplace_string_in_filetools fail on all existing files when connected via Remote-SSH (or WSL). The tools receive valid Unix paths but VS Code converts them to invalid Windows-style backslash paths internally.Minimal Reproduction Steps
Setup
code /tmp/copilot-bug-reproReproduce
Read the file /tmp/copilot-bug-repro/test.mdExpected Result
File content is returned successfully.
Actual Result
Root Cause Analysis
The tool receives the correct Unix path:
But the error shows a Windows-style backslash path:
The bug appears to be in
uriToFsPath()in VS Code's URI handling:This code runs because the VS Code host is Windows, but it incorrectly converts Unix paths from the remote filesystem.
Tool Status Matrix
grep_searchsemantic_searchfile_searchrun_in_terminalcreate_fileread_filereplace_string_in_filelist_dirKey Observation
Files created via
create_filetool work correctly withread_fileandreplace_string_in_file. Only pre-existing files fail. This suggests the tool registration uses correct paths for newly created files but has corrupted path mappings for existing workspace files.Window Output Log (Key Error)
Multiple similar errors for different files:
/home/kasperadm/IronKeyVault/docs/internal/ADR.../ADR-150-identity-integration-architecture.md/home/kasperadm/IronKeyVault/docs/internal/ADR.../ADR-140-login-authc-flow-user_admin-web.md/home/kasperadm/IronKeyVault/scripts/dev/modules/10-nginx.shAll show same pattern: Unix path input → backslash path in error.
Proposed Fix
In
uri.tsuriToFsPath()function, detect and preserve Unix paths:Impact
This bug makes Copilot Agent's file editing capabilities completely non-functional for:
Request Log
See attached:
chat-replay-2026-01-30.jsonchat-replay-2026-01-30.json
IronKeyVault commentedon Jan 30, 2026
Bryan Chen (@bryanchen-d)
GitHub Reply to MS Developer
Context: MS developer responded thinking the extension runs on WSL/remote side.
Thanks for looking into this! I think there might be a misunderstanding about the architecture.
The extension runs on the Windows host, not on WSL/remote side.
The problem:
isWindowscorrectly returnstrue(host is Windows)uriToFsPath()converts ALL paths to backslashes whenisWindows=true/home/user/file.mdbecomes\home\user\file.md→ invalidThe fix should check the path origin, not just host OS:
Paths starting with
/are definitionally Unix paths and should never be converted to backslashes, regardless of which OS the extension runs on.bryanchen-d commentedon Jan 30, 2026
By default it should be running on the WSL side. Aziki (@IronKeyVault) can you open command center (ctrl+shift+P) and run command "Show running extensions", in the Running Extensions window, check if the Github copilot chat extension is running from WSL?
IronKeyVault commentedon Jan 31, 2026
Bryan Chen (@bryanchen-d) you you are right. it runs on the remote side. I tried to spin up a linux rocky on a vm, to see if it made a difference. but no the issue is still here.
aeschli commentedon Feb 2, 2026
Your request logs contains:
When I run on WSL it says:
The OS we get from the node.process.
It would mean that your Copilot Chat extension runs on the UI side, or you are not in a remote WSL setup.
Here's how this should look.
IronKeyVault commentedon Feb 2, 2026
aeschli commentedon Feb 3, 2026
Best is to remove the entire
remote.extensionKindsection from your settings and use the defaults. This is a advanced setting and not all extensions can be configured like that.IronKeyVault commentedon Feb 7, 2026
Go ahead and close the case
dcuccia commentedon Feb 13, 2026
Stumbled on this too - here's the summary on my end: #280816 (comment)
IronKeyVault commentedon Feb 14, 2026
excatly same fix here.