microsoft / microsoft/winget-cli

WinGet Bug Report: Archive Extraction Fails with 0x80004005 (E_FAIL) for Valid ZIPs

Open
#5,670 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Command-Install Issue-Bug Needs-Repro Portable
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Relevant area(s)

WinGet CLI

Relevant command(s)

winget install

Brief description of your issue

winget install consistently fails at the archive extraction step for packages distributed as .zip files. Despite successful download and installer hash verification, the process yields a generic 0x80004005 (E_FAIL) error originating from AppInstallerCommonCore\Archive.cpp. Crucially, these same .zip archives can be extracted successfully by all other standard Windows tools (e.g., PowerShell's Expand-Archive, Windows File Explorer, 7-Zip).

This indicates a specific bug within WinGet's internal archive extraction implementation, rather than an issue with the archive itself or the system environment.

Steps to reproduce
  1. Open an elevated PowerShell or Command Prompt.
  2. Execute the command:
    winget install zufuliu.notepad4 --source winget --verbose-logs --disable-interactivity
    
3. Observe the command output, which shows the failure.

### Expected behavior

WinGet should successfully extract the `.zip` archive's contents into a temporary directory and complete the installation.

### Actual behavior


The command output indicates failure at the extraction step:

[...]
已成功验证安装程序哈希
正在提取存档...
未能提取存档内容


The verbose log shows the following critical error:
```log
[CLI ] Extracting archive to: C:\Users\HXY\AppData\Local\Temp\WinGet\zufuliu.notepad4.25.07r5738\extracted
[FAIL] C:\__w\1\s\external\pkg\src\AppInstallerCommonCore\Archive.cpp(30)\WindowsPackageManager.dll!... ReturnHr(1) tid(4fa8) 80004005 未指定的错误
[CLI ] Failed to extract archive with code -2147467259
[CLI ] Terminating context: 0x8a15005c at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\ArchiveFlow.cpp:4a
---

### **In-Depth Analysis & Troubleshooting**

#### **Crucial Finding: The Issue is Exclusive to WinGet's Extractor**

The most significant finding is that **the same `.zip` installer file that WinGet fails to extract can be extracted perfectly by other Windows tools.**

1.  The problematic `.zip` file was downloaded from the URL (`Notepad4_HD_zh-Hans_x64_v25.07r5738.zip`).
2.  Executing `Expand-Archive -Path "path\to\downloaded.zip" -DestinationPath "path\to\extract" -Force` in PowerShell succeeds without any errors.
3.  Manual extraction via Windows File Explorer and 7-Zip also works flawlessly.

#### **Troubleshooting Performed (All without success)**
Extensive troubleshooting was conducted to rule out environmental factors:
- **Permissions**: Ran `winget` in an elevated (Administrator) PowerShell session.
- **System Extractor**: Confirmed native system `tar.exe` is functional (`tar --version` returns `bsdtar 3.7.7`).
- **Security Software**: Temporarily disabled Windows Defender's "Real-time protection" and "Controlled folder access". No third-party antivirus is installed.
- **WinGet Health**: Performed a full `winget` repair (`Repair-WinGetPackageManager`), `winget source reset --force`, and cleared all WinGet caches.
- **System Encoding**: Explicitly toggled Windows' "Beta: Use Unicode UTF-8" feature (changing system ACP between `65001` and `936`). Confirmed all console/system encoding settings are consistent.
- **Network/Proxy**: Confirmed network connectivity and tested with and without proxy settings.

#### **Hypothesis**
The failure `0x80004005` (E_FAIL), combined with the successful `applying motw` log line, indicates a potential conflict where WinGet's internal extraction library **fails to correctly handle the "Mark of the Web" (MotW)** security metadata attached to downloaded files. The library might attempt an operation that is implicitly blocked or fails unexpectedly when encountering this security zone information, leading to the generic error.

winget-extraction-fail-log.log

Environment
winget --info
Windows Package Manager v1.11.430
Copyright (C) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.5768
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.26.430.0

Winget Directory
-------------------------------------------------------------------------------------------------------------------
Logs                   %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings          %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Portable Link Directory (User)   %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Link 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
Configuration Modules         %LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules

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

Administrator Settings                                Status
------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled
ProxyCommandLineOptions                   Disabled
DefaultProxy                              Disabled

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.

Research direction

Start by reproducing the winget install command with verbose logs, then inspect AppInstallerCommonCore\Archive.cpp at the reported failure and the archive workflow in AppInstallerCLICore\Workflows\ArchiveFlow.cpp. Compare the failing archive path with the successful extraction behavior described in the issue. Done means valid ZIP packages extract and the installation completes successfully.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.