Skip to content

winget source add doesn't warn you when adding an unsupported source. #1416

Closed

Description

Brief description of your issue

winget source add doesn't warn you when adding an unsupported source.

Steps to reproduce

  1. Stand up a REST Source that only advertises support for version 1.1.0 of the schema, not 1.0.0.
  2. As an administrator, run winget source add -n <name of repo> <address of repo> --type "Microsoft.Rest"
  3. Notice that it returns zero and acts like everything is hunky-dory.
  4. Try to use winget show/install/list/upgrade/search and realize they don't work because even though your source added successfully, it isn't supported by this version of winget.

Expected behavior

An error when you try to add the unsupported source. (So winget should reach out to the information endpoint and check the ServerSupportedVersions then. Or, better yet, have the winget client be able to handle minor schema changes, as right now it can't talk to 1.1.0 REST sources even if I set the ServerSupportedVersions to 1.0.0 because it doesn't know to ignore the new fields. but that's probably a separate bug).

Actual behavior

PS C:\Users\easton> sudo winget source reset --force
Resetting all sources...Done
PS C:\Users\easton> sudo winget source add -n eastonsrepo https://10.211.55.2:8000 --type "Microsoft.Rest"
Adding source:
  eastonsrepo -> https://10.211.55.2:8000
Done
PS C:\Users\easton> winget show --source eastonsrepo --id Microsoft.EdgeBeta --exact
Failed to open the source; try the 'source reset' command if the problem persists.
An unexpected error occurred while executing the command:
0x8a150038 : The configured rest source is not supported
PS C:\Users\easton> winget install Google.Chrome
Failed to open the source; try the 'source reset' command if the problem persists.
An unexpected error occurred while executing the command:
0x8a150038 : The configured rest source is not supported
PS C:\Users\easton> ((iwr https://10.211.55.2:8000/information/).Content | ConvertFrom-JSON).Data


SourceIdentifier              : A WinGet source!
SourceAgreements              :
ServerSupportedVersions       : {1.1.0}
UnsupportedPackageMatchFields :
RequiredPackageMatchFields    :
UnsupportedQueryParameters    :
RequiredQueryParameters       :



PS C:\Users\easton> # But you said 'adding source.... done' :(

Environment

[winget --info]
Windows Package Manager version 1.0.11694
Windows: Windows.Desktop version 10.0.22000.168
Package: Microsoft.DesktopAppInstaller version 1.15.11694.0

Any other software? I believe Microsoft Solitaire Collection is installed, if that changes anything :D

Activity

  1. ghost added
    Needs-Triage
    on Aug 30, 2021
  2. added
    Issue-Bug
    and removed
    Needs-Triage
    on Aug 30, 2021
  3. denelon commented on Aug 31, 2021

    @denelon
    Collaborator

    This should be fixed in PR #1396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions