microsoft / microsoft/winget-cli

both choco install or choco reinstall winget fail under win11 24H2 - ERROR: The type initializer for '<Module>' threw an exception.

Open
#5,181 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-External Issue-Bug
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

under win11 24H2 I find that trying to either install or upgrade winget using either choco install winget -y or choco upgrade winget -y I get the following errors:

choco install winget -y
Chocolatey v2.4.2
Installing the following packages:
winget
By installing, you accept licenses for the packages.
Downloading package from source 'https://chocolatey.org/api/v2/'
Progress: Downloading microsoft-vclibs-140-00 14.0.33321... 100%

microsoft-vclibs-140-00 v14.0.33321
microsoft-vclibs-140-00 package files install completed. Performing other installation steps.
ERROR: The type initializer for '<Module>' threw an exception.
The install of microsoft-vclibs-140-00 was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\microsoft-vclibs-140-00\tools\chocolateyInstall.ps1'.
 See log for details.
Failed to install winget-cli because a previous dependency failed.
Failed to install winget because a previous dependency failed.

Chocolatey installed 0/3 packages. 3 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - microsoft-vclibs-140-00 (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\microsoft-vclibs-140-00\tools\chocolateyInstall.ps1'.
 See log for details.
 - winget - Failed to install winget because a previous dependency failed.
 - winget-cli - Failed to install winget-cli because a previous dependency failed.

Is this a regression or dependency issue in Winget-cli, or a MS issue under win11 24H2?

I have also opened up an issue under Chris Titus's winutil as he also tries to install or reinstall winget, but I think the error or issue to be fixed lies here with chocolatey our with MS?

https://github.com/ChrisTitusTech/winutil/issues/3013

Steps to reproduce

choco install winget -y

Expected behavior

should install winget

Actual behavior

gives error as follows:

choco install winget -y
Chocolatey v2.4.2
Installing the following packages:
winget
By installing, you accept licenses for the packages.
Downloading package from source 'https://chocolatey.org/api/v2/'
Progress: Downloading microsoft-vclibs-140-00 14.0.33321... 100%

microsoft-vclibs-140-00 v14.0.33321
microsoft-vclibs-140-00 package files install completed. Performing other installation steps.
ERROR: The type initializer for '<Module>' threw an exception.
The install of microsoft-vclibs-140-00 was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\microsoft-vclibs-140-00\tools\chocolateyInstall.ps1'.
 See log for details.
Failed to install winget-cli because a previous dependency failed.
Failed to install winget because a previous dependency failed.

Chocolatey installed 0/3 packages. 3 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - microsoft-vclibs-140-00 (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\microsoft-vclibs-140-00\tools\chocolateyInstall.ps1'.
 See log for details.
 - winget - Failed to install winget because a previous dependency failed.
 - winget-cli - Failed to install winget-cli because a previous dependency failed.
Environment
[winget --info]
winget --info
Windows Package Manager v1.9.25200
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.26100.2894
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

Admin Setting                             State
--------------------------------------------------
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 choco install winget -y on Windows 11 24H2, then inspect C:\ProgramData\chocolatey\logs\chocolatey.log and the mentioned microsoft-vclibs-140-00 install script. Compare the failure with the linked winutil report to determine whether the cause is winget-cli, Chocolatey, the dependency, or Windows; done means identifying the responsible component and documenting a confirmed resolution.

Written by the indexing model from the issue text.

Assessment

Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.