microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
22.93k stars 1.42k forks source link

PowerShell client fails to install certain packages which work with the winget CLI #4661

Open fgimian opened 1 month ago

fgimian commented 1 month ago

Brief description of your issue

Installing the yt-dlp.yt-dlp package using the Install-WinGetPackage fails while the winget CLI works as expected.

Steps to reproduce

  1. Install the latest version of the Microsoft.WinGet.Client PowerShell package: Install-Module -Name Microsoft.WinGet.Client
  2. Attempt to install yt-dlp: Install-WinGetPackage -Id yt-dlp.yt-dlp -Scope System

Expected behavior

The package should install successfully.

Actual behavior

The package fails to install with the following output:

Administrator in ~\Downloads
🕙 [ 09:05:30 PM ] ❯ Install-WinGetPackage -Id yt-dlp.yt-dlp -Scope System

Id            Name   Source InstallerErrorCode Status        RebootRequired ExtendedErrorCode                                        C
                                                                                                                                     o
                                                                                                                                     r
                                                                                                                                     r
                                                                                                                                     e
                                                                                                                                     l
                                                                                                                                     a
                                                                                                                                     t
                                                                                                                                     i
                                                                                                                                     o
                                                                                                                                     n
                                                                                                                                     D
                                                                                                                                     a
                                                                                                                                     t
                                                                                                                                     a
--            ----   ------ ------------------ ------        -------------- -----------------                                        -
yt-dlp.yt-dlp yt-dlp winget 0                  DownloadError False          System.Runtime.InteropServices.COMException (0x8A150110)

And please see the relevant WinGetCOM.log log file below:

2024-07-22 21:07:44.042 [CORE] Passed in Correlation Vector Json is invalid: ; Error: * Line 1, Column 1
  Syntax error: value, object or array expected.

2024-07-22 21:07:44.042 [CORE] WinGet, version [1.8.1911], activity [{11B71C78-188B-43B3-9B84-BFF9F64841FA}]
2024-07-22 21:07:44.042 [CORE] OS: Windows.Desktop v10.0.22631.3880
2024-07-22 21:07:44.042 [CORE] Command line Args: C:\Users\Fots\AppData\Local\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\WindowsPackageManagerServer.exe --manualActivation
2024-07-22 21:07:44.042 [CORE] Package: Microsoft.DesktopAppInstaller v1.23.1911.0
2024-07-22 21:07:44.042 [CORE] IsCOMCall:1; Caller: C:\Program Files\PowerShell\7\pwsh.exe
2024-07-22 21:07:44.049 [CLI ] Executing command: download
2024-07-22 21:07:44.049 [REPO] Creating new SQLite Index with version [Latest] at ':memory:'
2024-07-22 21:07:44.053 [REPO] Reading MSI UpgradeCodes
2024-07-22 21:07:44.299 [REPO] Reading MSI UpgradeCodes
2024-07-22 21:07:45.531 [REPO] Opening database for ReadWrite at 'C:\Users\Fots\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2024-07-22 21:07:45.533 [REPO] Opened SQLite Index with version [1.7], last write [2024-07-21 12:17:28.000]
2024-07-22 21:07:46.730 [REPO] Attempting to open pinning database: C:\Users\Fots\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db
2024-07-22 21:07:46.731 [CLI ] Manifest fields: Name [FFmpeg], Version [7.0.1]
2024-07-22 21:07:47.903 [CLI ] Found existing installer file at 'C:\Users\Fots\AppData\Local\Temp\WinGet\Gyan.FFmpeg.7.0.1\ffmpeg-7.0.1-full_build.zip'. Verifying file hash.
2024-07-22 21:07:48.708 [CLI ] Existing installer file hash matches. Will use existing installer.
2024-07-22 21:07:48.708 [CLI ] Installer hash verified
2024-07-22 21:07:48.708 [CORE] Started applying motw to C:\Users\Fots\AppData\Local\Temp\WinGet\Gyan.FFmpeg.7.0.1\ffmpeg-7.0.1-full_build.zip with zone: 2
2024-07-22 21:07:48.709 [CORE] Finished applying motw
2024-07-22 21:07:48.824 [CLI ] Extracting archive to: C:\Users\Fots\AppData\Local\Temp\WinGet\Gyan.FFmpeg.7.0.1\extracted
2024-07-22 21:07:56.305 [CLI ] Successfully extracted archive
2024-07-22 21:07:56.414 [REPO] Opening database for ReadWrite at 'C:\Program Files\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe.db'
2024-07-22 21:07:56.415 [REPO] Opened Portable Index with version [1.0], last write [2024-07-22 21:06:06.000]
2024-07-22 21:07:56.418 [REPO] Opening database for ReadWrite at 'C:\Program Files\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe.db'
2024-07-22 21:07:56.418 [REPO] Opened Portable Index with version [1.0], last write [2024-07-22 21:06:06.000]
2024-07-22 21:07:56.418 [CLI ] Removing directory at C:\Program Files\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-7.0.1-full_build
2024-07-22 21:07:56.473 [CLI ] Deleting portable symlink at: C:\Program Files\WinGet\Links\ffmpeg.exe
2024-07-22 21:07:56.477 [CLI ] Deleting portable symlink at: C:\Program Files\WinGet\Links\ffplay.exe
2024-07-22 21:07:56.481 [CLI ] Deleting portable symlink at: C:\Program Files\WinGet\Links\ffprobe.exe
2024-07-22 21:07:56.485 [CLI ] Portable index deleted: C:\Program Files\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe.db
2024-07-22 21:07:56.485 [REPO] Creating new Portable Index with version [Latest] at 'C:\Program Files\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe.db'
2024-07-22 21:07:56.501 [CORE] Renaming directory to: C:\Program Files\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-7.0.1-full_build
2024-07-22 21:07:56.506 [CORE] Symlink created at: C:\Program Files\WinGet\Links\ffmpeg.exe
2024-07-22 21:07:56.510 [CORE] Symlink created at: C:\Program Files\WinGet\Links\ffplay.exe
2024-07-22 21:07:56.514 [CORE] Symlink created at: C:\Program Files\WinGet\Links\ffprobe.exe
2024-07-22 21:07:56.514 [CLI ] Portable target directory already exists in PATH registry: C:\Program Files\WinGet\Links
2024-07-22 21:07:56.519 [REPO] Opening database for ReadWrite at 'C:\Users\Fots\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2024-07-22 21:07:56.520 [REPO] Opened SQLite Index with version [1.7], last write [2024-07-21 12:17:28.000]
2024-07-22 21:07:57.911 [CLI ] Removing installer: C:\Users\Fots\AppData\Local\Temp\WinGet\Gyan.FFmpeg.7.0.1\extracted
2024-07-22 21:07:59.102 [CLI ] Found existing installer file at 'C:\Users\Fots\AppData\Local\Temp\WinGet\yt-dlp.yt-dlp.2024.07.16\yt-dlp.exe'. Verifying file hash.
2024-07-22 21:07:59.205 [CLI ] Existing installer file hash matches. Will use existing installer.
2024-07-22 21:07:59.205 [CLI ] Installer hash verified
2024-07-22 21:07:59.205 [CORE] Started applying motw to C:\Users\Fots\AppData\Local\Temp\WinGet\yt-dlp.yt-dlp.2024.07.16\yt-dlp.exe with zone: 2
2024-07-22 21:07:59.207 [CORE] Finished applying motw
2024-07-22 21:07:59.207 [CLI ] Executing command: install
2024-07-22 21:07:59.207 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerCLICore\ExecutionContext.cpp(456)\WindowsPackageManager.dll!00007FFD345DCA12: (caller: 00007FFD3467D93E) Exception(6) tid(2914) 8007139F The group or resource is not in the correct state to perform the requested operation.

    Msg:[Reporting ExecutionStage to an earlier Stage without allowBackward as true] 

2024-07-22 21:07:59.208 [CLI ] Caught wil::ResultException: C:\__w\1\s\external\pkg\src\AppInstallerCLICore\ExecutionContext.cpp(456)\WindowsPackageManager.dll!00007FFD345DCA12: (caller: 00007FFD3467D93E) Exception(6) tid(2914) 8007139F The group or resource is not in the correct state to perform the requested operation.

    Msg:[Reporting ExecutionStage to an earlier Stage without allowBackward as true] 

2024-07-22 21:07:59.209 [CLI ] Successfully refreshed process PATH environment variable.
2024-07-22 21:07:59.209 [CLI ] Terminating context: 0x8a150110 at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\InstallFlow.cpp:319

The winget CLI works just fine:

Administrator in ~\Downloads took 18s
🕙 [ 09:09:41 PM ] ❯ winget install yt-dlp.yt-dlp --scope machine
Found yt-dlp [yt-dlp.yt-dlp] Version 2024.07.16
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
This package requires the following dependencies:
  - Packages
      Gyan.FFmpeg
(1/1) Found FFmpeg [Gyan.FFmpeg] Version 7.0.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: "ffmpeg"
Command line alias added: "ffplay"
Command line alias added: "ffprobe"
Successfully installed

Successfully verified installer hash
Starting package install...
Command line alias added: "yt-dlp"
Successfully installed

Environment

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

Windows: Windows.Desktop v10.0.22631.3880
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.23.1911.0

PowerShell modules are listed below:

Name                            Version
----                            -------
Microsoft.PowerShell.Management 7.0.0.0
Microsoft.PowerShell.Utility    7.0.0.0
Microsoft.WinGet.Client         1.8.1911
posh-git                        1.1.0
PSReadLine                      2.2.6
github-actions[bot] commented 1 month ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

stephengillie commented 1 month ago

Since this only impacts the 1 package, it should be moved to the winget-pkgs repo.

fgimian commented 1 month ago

Since this only impacts the 1 package, it should be moved to the winget-pkgs repo.

* This is probably related to [[Package Issue]: yt-dlp.yt-dlp does not complete the update to version 2024.07.01 winget-pkgs#161349](https://github.com/microsoft/winget-pkgs/issues/161349), and might even be the same issue.

Thanks for your response. I can't be certain, but I do honestly believe this is a different issue as it doesn't affect the winget CLI, only the PowerShell module. It also relates to a fresh install instead of the package instead of an upgrade. The error message logged also appears to differ based on what I can see. 😄

Cheers Fotis