microsoft / microsoft/winget-cli

Failed to open the predefined source; please report to winger maintainers + This file does not have an app associated with it

Open
#5,177 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Bit of a two-in-one here, ran into some peculiar errors while running tests on a script of mine in a VM. They came in quick succession, which makes me wonder if they might be related somehow. The first error was pretty direct—while iterating through a loop through a loop of packages to install, winget returned with an error on the last element of the array. 0x80071130
Image
Shortly thereafter, I got an error trying to open a shortcut with a winget command.
Image
This second error is somewhat reminiscent of other errors I've gotten a few times, where the winget command was "not recognized"; but I can't confirm they're the same due to the different output formats (command line vs dialogue box).

Steps to reproduce

I can't give much info on how to reliably reproduce this, since it's happened just once out of many unchanged (in this dimension) tests. But I can give my setup:
Windows 11 Pro 24H2 en-GB ISO running in VMware Workstation Pro
And some of my script:

$NicePackages = @(
    <Various other packages>,
    'Rustlang.Rustup',
    'ShareX.ShareX',
    'Valve.Steam',
    'voidtools.everything' ## First error here
)
foreach($Package in $NicePackages) {
    winget install --id $Package --source winget
    Start-Sleep -Milliseconds 100 # This seems to help it not have random errors apparently
}
winget install Mozilla.Firefox --custom /PrivateBrowsingShortcut=false --source winget ## No error?
# Spotify won't install from an elevated session so we have to do this nonsense
$Shell = New-Object -ComObject WScript.Shell
$Shortcut = $Shell.CreateShortcut("$PSScriptRoot\Install.lnk")
$Shortcut.TargetPath = 'winget'
$Shortcut.Arguments = 'install Spotify.Spotify'
$Shortcut.Save()
explorer.exe "$PSScriptRoot\Install.lnk" ## Second error here
Start-Sleep 1 # We love race conditions don't we folks
Remove-Item -Path "$PSScriptRoot\Install.lnk"

*Double hashes represent added comments for the report
And I can also add the fact I was running Install-Language as a job in the background during this, on the off chance it's relevant.

Expected behavior

Winget should install the packages and not return errors

Actual behavior

Winget returns errors and does not install the packages

Environment
Windows: Windows.Desktop v10.0.26100.1742
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.10120.0

Unfortunately I cannot share any logs, as I've already reset the VM to continue testing the script. My apologies for this oversight.

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 PowerShell script in the stated Windows 11 and VMware environment, focusing on the final winget install and the explorer.exe shortcut launch. Capture fresh logs and test whether the background Install-Language job or timing affects either failure. Done means the failures are reproducible and their causes are separated, or both operations complete reliably.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.