Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Opening a PR from a URI handler link after VS Code restart showed "Path does not exist" error with a numeric path like \1761808101585.

Root cause: RepositoryCache._findWorkspaceForRepo called .fsPath on workspace.workspaceFile without checking its scheme. For untitled workspaces (untitled:1761808101585), .fsPath returns just the numeric timestamp ID. This invalid path was cached and later passed to Uri.file(), creating file:///1761808101585.

Changes:

  • Add scheme check before using workspaceFile.fsPath - only use workspace files with file scheme
  • For untitled workspaces, fall back to workspace folders which have valid paths
  • Add tests for untitled workspace handling and file-scheme workspace behavior
// Before: used any workspaceFile
if (this._workspaceFile) {
    folderPathOrWorkspaceFile = this._workspaceFile.fsPath;
}

// After: only use file-scheme workspaces
if (this._workspaceFile && this._workspaceFile.scheme === 'file') {
    folderPathOrWorkspaceFile = this._workspaceFile.fsPath;
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Error message on second open of PR from a link</issue_title>
<issue_description>Testing #274805

Repro Steps

  1. Enlist and load vscode repo
  2. From browser: open PR: vscode-insiders://github.vscode-pull-request-github/checkout-pull-request?%7B%22owner%22%3A%22microsoft%22%2C%22repo%22%3A%22vscode%22%2C%22pullRequestNumber%22%3A273860%7D
  3. Once complete, switch to Explorer View, close all other windows
  4. Close VS Code
  5. Reopen VS Code -> this will show empty env with vscode repo loaded in explorer
  6. From browser: open PR again: vscode-insiders://github.vscode-pull-request-github/checkout-pull-request?%7B%22owner%22%3A%22microsoft%22%2C%22repo%22%3A%22vscode%22%2C%22pullRequestNumber%22%3A273860%7D

Actual Result

Image

Expected Result
No Error</issue_description>

Comments on the Issue (you are @copilot in this section)

@dmitrivMS NOTE: If you open PR explorer pane first, it does not seem to happen. Logs: ``` 2025-11-04 14:07:50.691 [info] [Activation] Extension version: 0.121.2025110404 2025-11-04 14:07:50.704 [info] [Authentication] Creating hub for .com 2025-11-04 14:07:50.903 [info] [Activation] Looking for git repository 2025-11-04 14:07:50.903 [info] [Activation] Found 0 repositories during activation 2025-11-04 14:07:50.903 [info] [Activation] Git repository found, initializing review manager and pr tree view. 2025-11-04 14:07:50.904 [info] [GitAPI] Registering git provider 2025-11-04 14:07:50.918 [info] [GitAPI] Repository file:///c%3A/Users/dmitriv/repos/vscode has been opened 2025-11-04 14:07:54.989 [info] [Review+0] Validate state in progress 2025-11-04 14:07:54.989 [info] [Review+0] Validating state... 2025-11-04 14:07:54.989 [info] [FolderRepositoryManager+0] Cannot updates repositories as git is uninitialized 2025-11-04 14:07:54.989 [info] [Activation] Repo state for file:///c%3A/Users/dmitriv/repos/vscode changed. 2025-11-04 14:07:54.989 [info] [Activation] Repo file:///c%3A/Users/dmitriv/repos/vscode has already been setup. 2025-11-04 14:07:55.869 [info] [Activation] Git initialization state changed: state=initialized 2025-11-04 14:07:55.869 [info] [Review+0] Validate state in progress 2025-11-04 14:07:55.869 [info] [Review+0] Validating state... 2025-11-04 14:07:55.871 [info] [FolderRepositoryManager+0] Found GitHub remote for folder c:\Users\dmitriv\repos\vscode 2025-11-04 14:07:56.325 [info] [FolderRepositoryManager+0] Trying to use globalState for assignableUsers. 2025-11-04 14:07:56.421 [info] [Review+0] Found matching pull request metadata for current branch dev/dmitriv/glob-2. Repo: microsoft/vscode PR: 273860 2025-11-04 14:07:56.421 [info] [Review+0] current branch dev/dmitriv/glob-2 is associated with pull request #273860 2025-11-04 14:07:56.421 [info] [Review+0] Resolving pull request 2025-11-04 14:07:56.439 [info] [FolderRepositoryManager+0] Using globalState assignableUsers for 1. 2025-11-04 14:07:57.148 [info] [FolderRepositoryManager+0] Using in-memory cached assignable users. 2025-11-04 14:07:57.699 [info] [GitHubRepository+0] Fetch branch main - enter 2025-11-04 14:07:58.140 [info] [GitHubRepository+0] Fetch branch main - done: true 2025-11-04 14:07:58.148 [info] [Review+0] Resolved PR #273860, state is OPEN 2025-11-04 14:07:58.148 [info] [Review+0] Fetching pull request data 2025-11-04 14:07:58.148 [info] [PullRequestTree] Adding PR #273860 to tree 2025-11-04 14:07:58.167 [info] [Review+0] Register comments provider 2025-11-04 14:07:58.168 [info] [Review+0] Register in memory content provider 2025-11-04 14:07:59.175 [info] [Review+0] Display pull request status bar indicator. 2025-11-04 14:07:59.175 [info] [Review+0] Using focus mode = true. 2025-11-04 14:07:59.175 [info] [Review+0] State validation silent = true. 2025-11-04 14:07:59.175 [info] [Review+0] PR show should show = false. ``` @alexr00 I haven't been able to repro this, and it's strange because where that error comes from there must be a `file` scheme URI, which points to the workspace we're trying to open being incorrect. Adding some logging. @alexr00 New pre-release is building now. @dmitrivMS, could you please install the new pre-release once it's available, repro the bug, then share the output of GitHub Pull Request? @dmitrivMS @alexr00 Still repros. Image

One correction to the repro steps above (not sure if it matters): I am opening a PR for which I have a local branch and it is ...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

When the workspace file has 'untitled' scheme (an unsaved workspace),
calling .fsPath on it returns just a numeric timestamp ID like
'1761808101585'. This ID was being stored in the cache and later
converted to a file:// URI, causing "Path does not exist" errors.

Fix by checking that the workspace file has 'file' scheme before
using its fsPath. For untitled workspaces, fall back to using the
workspace folders instead.

Fixes #276925

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error message on second open of PR from a link Fix git repository cache to skip untitled workspaces Feb 4, 2026
Copilot AI requested a review from alexr00 February 4, 2026 12:12
@alexr00 alexr00 closed this Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error message on second open of PR from a link

2 participants