Corrupted installation state after partial update failure
0 reputation · 02 Jul 2023, 19:24 UTC
0 reputation · 02 Jul 2023, 19:24 UTC
Visual Studio Code employs a background update mechanism that downloads packages to a separate directory before swapping the active installation. While the system is designed to maintain the previous stable version if a download fails, a partial update failure during the swap process can lead to an inconsistent binary state.
When a manual rollback to a previous version is performed following such a failure, the internal cache states may not synchronize automatically with the restored binary version. This creates uncertainty regarding how the application handles cached metadata that was generated by a newer, partially installed version.
Does the update manager provide a mechanism to clear version-specific internal caches during a manual rollback? How does the application ensure cache compatibility when the binary version is downgraded after a failed update attempt?
32275 reputation · 03 Jul 2023, 01:26 UTC
VS Code’s update manager does not automatically purge the internal cache when you manually roll back to a previous version. The cache (located in the user‑data folder) may still contain metadata that was generated by the newer, partially‑installed build. The application will only clear or rebuild incompatible cache entries on the next normal upgrade; a manual downgrade leaves them untouched.
product.json file that records the target version.product.json; if the cache’s version field is newer than the running binary, it will normally delete the whole Cache directory. A manual rollback bypasses this check.%APPDATA%\Code~/Library/Application Support/Code~/.config/CodeCache folder (and optionally the CachedData folder if present). This forces VS Code to rebuild cache items on the next launch.
Update or update) to avoid re‑attempting the incomplete swap.
code --install-extension for each, or simply restart VS Code; it will prompt to reinstall missing extensions.
# On Windows PowerShell
Remove-Item -Recurse -Force "$env:APPDATA\Code\Cache"
# On macOS/Linux
rm -rf ~/.config/Code/Cache
# Open VS Code and check the Output panel for "Cache cleaned" or similar message
If cache clearing does not resolve the issue, the safest fallback is a clean uninstall followed by a fresh download from the official website. This guarantees that all binaries and metadata are regenerated from scratch.
To fine‑tune the recommendation, please share the exact error code or log message that appeared during the failed update (e.g., a 0x80070005 on Windows or a dpkg error). That can indicate whether a registry entry is missing or a particular extension is corrupted.
Use comments to ask for clarification. Post a solution as an answer.
32,275 reputation · 02 Jul 2023, 21:04 UTC
Not all of VS Code's caches behave the same way on downgrade. The compiled-JS cache under CachedData is keyed per build commit hash, so after a rollback the stale entries are simply ignored and regenerated — they rarely cause a conflict on their own. The more common post-rollback symptom is extension-related: extensions updated for the newer engine may declare an engines.vscode range the downgraded build doesn't satisfy, so VS Code disables them or fetches a compatible version.
CachedData, CachedExtensions, CachedExtensionVSIXs, Code Cache, GPUCache) — wiping the whole user-data directory also removes settings and keybindings.CachedData subfolder names to confirm which build the stale cache belongs to.