Skip to content

winget install requires --source even when only one result exists from working sources #6164

@Sinan-Karakaya

Description

@Sinan-Karakaya

Relevant area(s)

WinGet CLI

Relevant command(s)

winget install

Brief description of your issue

When you have multiple sources configured and one of them is unreachable (e.g. a corporate feed that's offline, or a source that's temporarily down), winget install <package> will fail with something like:

The following packages were found in the working sources.
Please specify one of them using the --source option to continue.

...even if only a single package was found. There's nothing ambiguous about the result: one package, one source, but winget still refuses to proceed and forces you to re-run the command with an explicit --source flag.

This is pretty annoying in practice. If I have a private source that's down and I want to install something from the public winget source, I shouldn't need to know upfront that my other source is broken and manually work around it.

The right behavior should be: if exactly one result comes back from the sources that are working, just use it. The --source prompt makes sense when there are actually multiple ambiguous results to choose from, not when the answer is obvious.

Steps to reproduce

Add a second source that is unreachable (or take one offline temporarily)
Run winget install where the package exists on one of the working sources
Observe the error requiring --source despite there being a single unambiguous result

Expected behavior

When there is only one source available, winget shouldn't ask me to specify the --source flag, this is redundant.

Actual behavior

Winget returns this kind of error:

The following packages were found in the working sources.
Please specify one of them using the --source option to continue.

Environment

Gestionnaire de package Windows v1.9.25200
Copyright (c) Microsoft Corporation. Tous droits réservés.

Windows: Windows.Desktop v10.0.26200.8246
Architecture du système : X64
Package : Microsoft.DesktopAppInstaller v1.24.25200.0

Répertoires Winget
-----------------------------------------------------------------------------------------------------------------------
Journaux                                     %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\Local…
Paramètres utilisateurs                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\Local…
Répertoire des liens portables (utilisateur) %LOCALAPPDATA%\Microsoft\WinGet\Links
Répertoire des liens portables (ordinateur)  C:\Program Files\WinGet\Links
Racine de package portable (utilisateur)     %LOCALAPPDATA%\Microsoft\WinGet\Packages
Racine du package portable                   C:\Program Files\WinGet\Packages
Racine de package portable (x86)             C:\Program Files (x86)\WinGet\Packages
Téléchargements du programme d’installation  %USERPROFILE%\Downloads

Liens
---------------------------------------------------------------------------------------------
Déclaration de confidentialité        https://aka.ms/winget-privacy
Contrat de licence                    https://aka.ms/winget-license
Avis de tiers                         https://aka.ms/winget-3rdPartyNotice
Page d’accueil                        https://aka.ms/winget
Conditions générales du Windows Store https://www.microsoft.com/en-us/storedocs/terms-of-sale

Paramètre administrateur                  État
---------------------------------------------------
LocalManifestFiles                        Désactivé
BypassCertificatePinningForMicrosoftStore Désactivé
InstallerHashOverride                     Désactivé
LocalArchiveMalwareScanOverride           Désactivé
ProxyCommandLineOptions                   Désactivé
DefaultProxy                              Désactivé

Metadata

Metadata

Assignees

No one assigned

    Labels

    Command-InstallIssue related to WinGet InstallIssue-BugIt either shouldn't be doing this or needs an investigation.

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions