Skip to content

Insiders Update Fails - Windows - MoveFile failed; code 5. Access is denied #312125

@wymangr

Description

@wymangr

Does this issue occur when all extensions are disabled?: No (issue is with the auto-updater, not the editor itself)

  • VS Code Version: Insiders
Version: 1.118.0-insider (user setup)
Commit: 102df5b59f1c706f14aee2259d4ec60a6acee55c
Date: 2026-04-22T11:25:25Z
Electron: 39.8.8
ElectronBuildId: 13870025
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200
  • OS Version: Windows 11 Pro 25H2 (10.0.26200), single user, non-managed, no MDM/Group Policy

Steps to Reproduce

  1. Have VS Code Insiders installed per-user (C:\Users\<name>\AppData\Local\Programs\Microsoft VS Code Insiders)
  2. Allow VS Code Insiders to detect and attempt an automatic update (Help → Check for Updates)
  3. Observe the error dialog: "An error occurred while trying to rename a file in the destination directory: MoveFile failed; code 5. Access is denied." pointing to a .pak file in the new commit subfolder (e.g. 102df5b59f\chrome_100_percent.pak)
Image

What Happens

The auto-updater downloads the update successfully and completes the file removal phase without errors (confirmed via vscode-inno-updater-*.log in %TEMP%). The failure occurs when the updater spawns the Inno Setup installer as a subprocess to extract the new version.

The Inno Setup log (%TEMP%\Setup Log *.txt) shows the installer is being launched with no privileges:

2026-04-22 10:14:23.159   Compatibility mode: Yes (RunAsInvoker)
2026-04-22 10:14:23.159   User privileges: None

A normal per-user install should show User privileges: Standard. The RunAsInvoker compatibility mode causes the subprocess to inherit a restricted token from the VS Code parent process, stripping it of the permissions needed to write to its own install directory — even though the user is the owner of that directory.

The full Inno Setup installer command spawned by the updater:

CodeSetup-insider-<hash>.exe /verysilent /log /update="..." /progress="..." /sessionend="..." /cancel="..." /nocloseapplications /mergetasks=runcode,!desktopicon,!quicklaunchicon

The installer retries MoveFile four times before giving up:

2026-04-22 10:14:24.404   MoveFile: The existing file appears to be in use (5). Retrying.
2026-04-22 10:14:25.410   MoveFile: The existing file appears to be in use (5). Retrying.
2026-04-22 10:14:26.417   MoveFile: The existing file appears to be in use (5). Retrying.
2026-04-22 10:14:27.424   MoveFile: The existing file appears to be in use (5). Retrying.
2026-04-22 10:14:28.439   Message box (Abort/Retry/Ignore): MoveFile failed; code 5. Access is denied.

The target file does not exist prior to the install attempt — this is not a file-locking issue. The failure is a permissions issue caused by the restricted token.

What is Expected

The auto-updater completes successfully. The Inno Setup subprocess should run with User privileges: Standard, not User privileges: None.

Key Finding

Running the downloaded installer manually from %TEMP%\vscode-insider-user-x64\CodeSetup-insider-<hash>.exe as the same user completes successfully without any errors. This confirms the issue is specific to how VS Code spawns the Inno Setup subprocess via RunAsInvoker, causing it to inherit a restricted token.

What Workarounds Were Attempted

  • Full uninstall and reinstall — issue recurs on next update cycle
  • Remove %APPDATA%\Code - Insiders directory
  • Remove %USERPROFILE%.vscode-agents-insiders directory
  • takeown and icacls /reset on the install directory
  • Clearing %TEMP%\SquirrelTemp
  • Disabling Windows Defender real-time protection
  • Killing all integrated terminals before updating
  • Closing and freshly reopening VS Code before triggering update
  • Adjusting UAC ConsentPromptBehaviorAdmin registry value
  • No third-party AV, no MDM/Group Policy, no VS Code scheduled tasks present

Workaround

Setting "update.mode": "manual" in settings and downloading the installer directly from https://code.visualstudio.com/insiders/ works reliably, as does running the downloaded installer manually from the temp folder.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions