Skip to content

GitHub Copilot edit tool needs path normalization #284697

Closed as not planned
Closed as not planned

Description

I'm using Git Bash on Windows. Windows paths are usually in the form C:\foo\bar.txt, but Git Bash uses the form /c/foo/bar.txt for consistency with *nix. It also accepts the form /c:/foo/bar.txt.

As you know LLMs arbitrarily throw you for a loop sometimes, so in this case the LLM wanted to work with something like C:\foo\bar.txt. But for whatever reason, the LLM apparently used the form \r\foo\bar.txt, which is neither /c/foo/bar.txt nor /c:/foo/bar.txt.

Expectation: GitHub Copilot normalizes requested paths before comparing them with the workspace path when tools are used.
Actual: GitHub Copilot apparently did not normalize the path, and presented a message:

The model wants to edit files outside of your workspace (foo.txt). Do you want to allow this?

(Here is the actual Markdown I copied; I think this is an incorrect copying—a different issue about how VS Code produces the Markdown for copying: The model wants to edit files outside of your workspace ([foo.txt](vscode-file://vscode-app/c:/Users/user/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html)). Do you want to allow this?)

In other words, VS Code didn't understand that \r\foo\bar.txt is equivalent to /c/foo/bar.txt on Git Bash on Windows.

I can understand if the LLM tried to use that in the terminal and it didn't work, because Bash thinks the backslashes are some sort of escape. But when the LLM goes through the tool, the tool should normalize paths, and recognize how to normalize paths for Git Bash on Windows—or normalize them to whatever OS API the tools is using. The point is that \r\foo\bar.txt is a mismash that is neither a native Windows path nor a Git Bash for Windows version of the path. There is surely some way to detect this and either normalize the path, or tell the LLM the supplied path is invalid and provide an example so that it can correct itself.

Epilogue: This was in the middle of a huge, important refactoring, and I didn't want to break the flow, so I allowed the editing even though it was supposedly "outside the workspace". The tool still couldn't perform the editing then for some reason, and the LLM reported:

The file exists but VS Code can't read it because it's outside the workspace. Let me run a shell command to make the edit …

At this point I chimed in and told the LLM:

I think you were using the incorrect path format to try to edit the file. Try again using the correct format with the correct path in the workspace, as you normally do.

It was then able to edit the file. It noted:

Used Windows path format for workspace structure

So I'm not sure how to recommend fixing this, because I'm not sure what the code does already and what format it uses. But in any case, \r\foo\bar.txt is incorrect any way you look at it and should be normalized.

Activity

  1. added
    chat-ext-issue
    on Dec 21, 2025
  2. removed
    chat-ext-issue
    on Dec 21, 2025
  3. garretwilson commented on Dec 21, 2025

    @garretwilson
    Author

    Upon further thought, I'm not sure that my use of Git Bash had anything to do with this, as the LLM was not using the terminal. Perhaps it got confused after using Git Bash paths in the terminal, and then mixed the two formats. But for its actual request of editing tool usage, I don't think Git Bash would have been involved. So this may simple require checking for this odd corner case from an LLM when using the editing tool, and either normalizing the path for Windows or telling the LLM to correct the path format for Windows and try again.

  4. connor4312 commented on Jan 4, 2026

    @connor4312
    Member
  5. added
    info-needed
    on Jan 4, 2026
  6. garretwilson commented on Jan 4, 2026

    @garretwilson
    Author

    I frankly don't see this issue very often, and I'm not super-excited to share the mounds of request log information in the debug chat which is hard to examine individually for PPI. The next time it happens I'll see what I can produce for you, though.

    However coincidentally the following just happened, which is different but related. For some reason Claude Opus 4.5 out of the blue decided to include a reference in the response:

    The clearest example is in [FooBar.java](c:\stuff\project\foo\bar.java#L123-L456).

    Normally the LLM produces workspace-relative links, and I can click on the links and see the file. But clicking on this absolute link in Windows standard file system path form produces a VS Code error dialog "Unable to open 'FooBar.java'" with a message "Unable to resolve resource c:%5stuff%5project…".

    I realize this was to some extent the unpredictability of the LLM. I also realize that this is a separate issue. I also realize that this ticket is not the thing reducing my productivity as much day-to-day as other tickets.

    So while I hope VS Code can add workarounds to these sort of path issues, I understand and support other tickets getting a higher priority. I'll provide more information if possible when this happens again. Thanks.

  7. connor4312 commented on Jan 5, 2026

    @connor4312
    Member

    Thanks for the info, cc Vijay Upadya (@vijayupadya) on linkification ^

    If you are able to capture logs that you don't want to share publicly, you can also email them to me at [email protected]. Thanks!

  8. vs-code-engineering commented on Jan 13, 2026

    @vs-code-engineering
    Contributor

    This issue has been closed as it has been labeled with info-needed and has not received the additional information that was requested from the issue author. It has been labeled as info-needed for 7 days.

  9. locked and limited conversation to collaborators on Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions