Skip to content

Winget increases version number when failing to upgrade zip/portable installer #5235

Description

@timbretimber

Brief description of your issue

When attempting to upgrade a portable program while the file is in use, it will fail as expected and winget exits with the correct error but still marks it as upgraded wherever it tracks versions. This prevents an actual upgrade without first uninstalling and reinstalling the program and could be potentially dangerous if it's not caught.

Steps to reproduce

winget.exe install Docker.DockerCLI  --version 27.5.1
Found Docker CLI [Docker.DockerCLI] Version 27.5.1
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Extracting archive...
Successfully extracted archive
Starting package install...
Command line alias added: "docker"
Command line alias added: "dockerd"
Successfully installed
install.log

2025-02-20 12:34:38.508 [CORE] WinGet, version [1.9.25200], activity [{BA1D032F-B0EB-4BE4-8CFF-E265B625A7E1}]
2025-02-20 12:34:38.508 [CORE] OS: Windows.Desktop v10.0.22631.4890
2025-02-20 12:34:38.508 [CORE] Command line Args: "%LOCALAPPDATA%\Microsoft\WindowsApps\winget.exe" install Docker.DockerCLI --version 27.5.1
2025-02-20 12:34:38.509 [CORE] Package: Microsoft.DesktopAppInstaller v1.24.25200.0
2025-02-20 12:34:38.509 [CORE] IsCOMCall:0; Caller: winget-cli
2025-02-20 12:34:38.514 [CLI ] WinGet invoked with arguments: 'install' 'Docker.DockerCLI' '--version' '27.5.1'
2025-02-20 12:34:38.514 [CLI ] Found subcommand: install
2025-02-20 12:34:38.514 [CLI ] Leaf command to execute: root:install
2025-02-20 12:34:38.516 [CLI ] Executing command: install
2025-02-20 12:34:38.516 [REPO] The default source msstore is disabled due to Group Policy
2025-02-20 12:34:38.522 [REPO] Default source requested, only 1 source available, using the only source: winget
2025-02-20 12:34:38.522 [REPO] The default source msstore is disabled due to Group Policy
2025-02-20 12:34:38.522 [REPO] Named source requested, found: winget
2025-02-20 12:34:38.523 [CLI ] Created authentication arguments. Mode: silentPreferred, Account:
2025-02-20 12:34:38.530 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2025-02-20 12:34:38.531 [CORE] Found matching extension.
2025-02-20 12:34:38.537 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2025-02-20 12:34:38.537 [CORE] Found matching extension.
2025-02-20 12:34:38.552 [REPO] Opening database for ImmutableRead at 'C:\Program Files\WindowsApps\Microsoft.Winget.Source_2025.220.2012.57_neutral__8wekyb3d8bbwe\Public\index.db'
2025-02-20 12:34:38.552 [REPO] Opened SQLite Index with version [2.0], last write [2025-02-20 12:12:11.000]
2025-02-20 12:34:38.889 [REPO] The default source msstore is disabled due to Group Policy
2025-02-20 12:34:38.894 [REPO] Creating new SQLite Index with version [Latest] at ':memory:'
2025-02-20 12:34:38.905 [REPO] Reading MSI UpgradeCodes
2025-02-20 12:34:38.985 [REPO] Reading MSI UpgradeCodes
2025-02-20 12:34:39.528 [REPO] Opening database for ReadWrite at '%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2025-02-20 12:34:39.529 [REPO] Opened SQLite Index with version [1.7], last write [2025-02-20 12:28:38.000]
2025-02-20 12:34:39.652 [CLI ] Found one app. App id: Docker.DockerCLI App name: Docker CLI
2025-02-20 12:34:39.656 [REPO] Attempting to open pinning database: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db
2025-02-20 12:34:39.656 [REPO] ... opening existing pinning database
2025-02-20 12:34:39.656 [REPO] Opening database for Read at '%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db'
2025-02-20 12:34:39.656 [REPO] Opened Pinning Index with version [1.0], last write [2024-11-27 06:34:42.000]
2025-02-20 12:34:39.658 [CLI ] Manifest fields: Name [Docker CLI], Version [27.5.1]
2025-02-20 12:34:39.740 [CLI ] Found existing installer file at '%TEMP%\WinGet\Docker.DockerCLI.27.5.1\docker-27.5.1.zip'. Verifying file hash.
2025-02-20 12:34:39.773 [CLI ] Existing installer file hash matches. Will use existing installer.
2025-02-20 12:34:39.773 [CLI ] Installer hash verified
2025-02-20 12:34:39.773 [CORE] Started applying motw to %TEMP%\WinGet\Docker.DockerCLI.27.5.1\docker-27.5.1.zip with zone: 2
2025-02-20 12:34:39.774 [CORE] Finished applying motw
2025-02-20 12:34:39.884 [CLI ] Extracting archive to: %TEMP%\WinGet\Docker.DockerCLI.27.5.1\extracted
2025-02-20 12:34:40.589 [CLI ] Successfully extracted archive
2025-02-20 12:34:40.702 [CORE] Created target install directory: C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe
2025-02-20 12:34:40.702 [REPO] Creating new Portable Index with version [Latest] at 'C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe.db'
2025-02-20 12:34:40.719 [CORE] Renaming directory to: C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\docker
2025-02-20 12:34:40.725 [CORE] Symlink created at: C:\Program Files\WinGet\Links\docker.exe with target path: C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\docker\docker.exe
2025-02-20 12:34:40.729 [CORE] Symlink created at: C:\Program Files\WinGet\Links\dockerd.exe with target path: C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\docker\dockerd.exe
2025-02-20 12:34:40.730 [CLI ] Portable target directory already exists in PATH registry: C:\Program Files\WinGet\Links
2025-02-20 12:34:40.737 [REPO] Opening database for ReadWrite at '%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2025-02-20 12:34:40.738 [REPO] Opened SQLite Index with version [1.7], last write [2025-02-20 12:28:38.000]
2025-02-20 12:34:40.843 [CLI ] Removing installer: %TEMP%\WinGet\Docker.DockerCLI.27.5.1\extracted
2025-02-20 12:34:40.843 [CLI ] Leaf command succeeded: root:install

docker run --rm busybox tail -f /dev/null
# any command to keep executable in use
winget.exe update Docker.DockerCLI
Found Docker CLI [Docker.DockerCLI] Version 28.0.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Extracting archive...
Successfully extracted archive
Starting package install...
An unexpected error occurred while executing the command:
remove_all: Access is denied.: "C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\docker"
Installer failed with exit code: 0x8a150003 : Executing command failed
update.log

2025-02-20 12:36:47.866 [CORE] WinGet, version [1.9.25200], activity [{4504E953-CE63-46BC-B48C-CE44C3ACF4A0}]
2025-02-20 12:36:47.867 [CORE] OS: Windows.Desktop v10.0.22631.4890
2025-02-20 12:36:47.867 [CORE] Command line Args: "%LOCALAPPDATA%\Microsoft\WindowsApps\winget.exe" update Docker.DockerCLI
2025-02-20 12:36:47.867 [CORE] Package: Microsoft.DesktopAppInstaller v1.24.25200.0
2025-02-20 12:36:47.867 [CORE] IsCOMCall:0; Caller: winget-cli
2025-02-20 12:36:47.877 [CLI ] WinGet invoked with arguments: 'update' 'Docker.DockerCLI'
2025-02-20 12:36:47.878 [CLI ] Found subcommand: update
2025-02-20 12:36:47.878 [CLI ] Leaf command to execute: root:upgrade
2025-02-20 12:36:47.882 [CLI ] Executing command: upgrade
2025-02-20 12:36:47.882 [REPO] The default source msstore is disabled due to Group Policy
2025-02-20 12:36:47.895 [REPO] Default source requested, only 1 source available, using the only source: winget
2025-02-20 12:36:47.895 [REPO] The default source msstore is disabled due to Group Policy
2025-02-20 12:36:47.895 [REPO] Named source requested, found: winget
2025-02-20 12:36:47.896 [CLI ] Created authentication arguments. Mode: silentPreferred, Account:
2025-02-20 12:36:47.907 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2025-02-20 12:36:47.907 [CORE] Found matching extension.
2025-02-20 12:36:47.921 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2025-02-20 12:36:47.921 [CORE] Found matching extension.
2025-02-20 12:36:47.943 [REPO] Opening database for ImmutableRead at 'C:\Program Files\WindowsApps\Microsoft.Winget.Source_2025.220.2012.57_neutral__8wekyb3d8bbwe\Public\index.db'
2025-02-20 12:36:47.944 [REPO] Opened SQLite Index with version [2.0], last write [2025-02-20 12:12:11.000]
2025-02-20 12:36:48.262 [REPO] The default source msstore is disabled due to Group Policy
2025-02-20 12:36:48.266 [REPO] Creating new SQLite Index with version [Latest] at ':memory:'
2025-02-20 12:36:48.278 [REPO] Reading MSI UpgradeCodes
2025-02-20 12:36:48.340 [REPO] Reading MSI UpgradeCodes
2025-02-20 12:36:48.646 [REPO] Opening database for ReadWrite at '%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2025-02-20 12:36:48.647 [REPO] Opened SQLite Index with version [1.7], last write [2025-02-20 12:28:38.000]
2025-02-20 12:36:48.810 [CLI ] Found one app. App id: Docker.DockerCLI App name: Docker CLI
2025-02-20 12:36:48.813 [REPO] Attempting to open pinning database: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db
2025-02-20 12:36:48.814 [REPO] ... opening existing pinning database
2025-02-20 12:36:48.814 [REPO] Opening database for Read at '%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db'
2025-02-20 12:36:48.814 [REPO] Opened Pinning Index with version [1.0], last write [2024-11-27 06:34:42.000]
2025-02-20 12:36:48.814 [CLI ] Manifest fields: Name [Docker CLI], Version [28.0.0]
2025-02-20 12:36:48.882 [CLI ] Found existing installer file at '%TEMP%\WinGet\Docker.DockerCLI.28.0.0\docker-28.0.0.zip'. Verifying file hash.
2025-02-20 12:36:48.917 [CLI ] Existing installer file hash matches. Will use existing installer.
2025-02-20 12:36:48.917 [CLI ] Installer hash verified
2025-02-20 12:36:48.918 [CORE] Started applying motw to %TEMP%\WinGet\Docker.DockerCLI.28.0.0\docker-28.0.0.zip with zone: 2
2025-02-20 12:36:48.918 [CORE] Finished applying motw
2025-02-20 12:36:49.020 [CLI ] Extracting archive to: %TEMP%\WinGet\Docker.DockerCLI.28.0.0\extracted
2025-02-20 12:36:49.725 [CLI ] Successfully extracted archive
2025-02-20 12:36:49.843 [REPO] Opening database for ReadWrite at 'C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe.db'
2025-02-20 12:36:49.844 [REPO] Opened Portable Index with version [1.0], last write [2025-02-20 12:34:40.000]
2025-02-20 12:36:49.849 [REPO] Opening database for ReadWrite at 'C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe.db'
2025-02-20 12:36:49.850 [REPO] Opened Portable Index with version [1.0], last write [2025-02-20 12:34:40.000]
2025-02-20 12:36:49.850 [CLI ] Removing directory at C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\docker
2025-02-20 12:36:49.850 [CLI ] Caught std::exception: remove_all: Access is denied.: "C:\Program Files\WinGet\Packages\Docker.DockerCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\docker"
2025-02-20 12:36:49.852 [CLI ] Portable installer failed: 2316632067
2025-02-20 12:36:49.852 [CLI ] Terminating context: 0x8a150052 at C:__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\InstallFlow.cpp:221

echo $LASTEXITCODE
-1978335150 # APPINSTALLER_CLI_ERROR_PORTABLE_INSTALL_FAILED
docker --version
Docker version 27.5.1, build 9f9e405
winget.exe list Docker.DockerCLI
Name       Id               Version
-----------------------------------
Docker CLI Docker.DockerCLI 28.0.0

Expected behavior

If the command fails for any reason the version should not increase.

Actual behavior

The version number increases after an unsuccessful upgrade.

Environment

Windows Package Manager v1.9.25200
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.4890
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.24.25200.0

Winget Directories                 
-----------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages
Installer Downloads                %USERPROFILE%\Downloads

Links               
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale


Group Policy                                        State
------------------------------------------------------------
Enable Windows App Installer Microsoft Store Source Disabled

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled
ProxyCommandLineOptions                   Enabled
DefaultProxy                              Disabled

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions