Git: getRepositoryExact loops infinitely with ENOENT error after workspace folder rename

Open
#322,487 1 comment 0 reactions 1 assignee View on GitHub

@lszomoru is already working on this.

Since Jun 23, 2026.

Assessment

This issue has not been assessed yet.

Description

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.125.1 (user setup)
  • Commit: fcf604774b9f2674b473065736ee75077e256353
  • Date: 2026-06-19T08:39:34Z
  • Electron: 42.2.0
  • ElectronBuildId: 14159160
  • Chromium: 148.0.7778.97
  • Node.js: 24.15.0
  • V8: 14.8.178.14-electron.0
  • OS Version: Windows_NT x64 10.0.26200

Steps to Reproduce:

  1. Open a project located in a directory (e.g., e:\aaa\bbb) that is initialized as a Git repository.
  2. Rename the project's root folder using Windows File Explorer.
  3. Open the newly renamed folder in VS Code and delete its .git folder to stop version control tracking.
  4. The built-in Git extension crashes into an infinite, high-frequency loop running git rev-parse --show-toplevel.
  5. The Git output channel constantly spams thousands of lines saying fatal: not a git repository (or any of the parent directories): .git.
  6. Immediately following, the extension model spams warnings: [warning] [Model][getRepositoryExact] Failed to get repository realpath for: ... Error: ENOENT: no such file or directory, realpath.
  7. Even if you reset workspace profiles, use Developer: Reset State, reload windows, close the folder completely, or temporarily rename the folder back to its original name, the internal path state remains desynchronized. If renamed back, it instead loops complaining that the "new" name cannot be found via ENOENT.
Git Log Output Sample:
2026-06-23 10:11:34.479 [info] > git rev-parse --show-toplevel [29ms]
2026-06-23 10:11:34.479 [info] fatal: not a git repository (or any of the parent directories): .git
2026-06-23 10:11:35.423 [warning] [Model][getRepositoryExact] Failed to get repository realpath for: "e:\aaa\bbb". Error:Error: ENOENT: no such file or directory, realpath 'e:\aaa\bbb'
Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.