Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "An error occurred while connecting to the catalog" on Find-WinGetPackage #4022

Closed
norsemangrey opened this issue Jan 3, 2024 · 13 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback Issue needs attention from issue or PR author PowerShell Issue related to WinGet PowerShell Module or cmdlet
Milestone

Comments

@norsemangrey
Copy link

norsemangrey commented Jan 3, 2024

Brief description of your issue

When running Find-WinGetPackage or Get-WinGetPackage I get the error An error occurred while connecting to the catalog.

winget find is working normally.

Steps to reproduce

Install on PowerShell 7.4.0 using Install-Module -Name Microsoft.WinGet.Client -AcceptLicense and afterwards run e.g. Find-WinGetPackage Adobe.

Expected behavior

Expected to list found packages.

Actual behavior

I get the error An error occurred while connecting to the catalog.

Environment

Windows Package Manager (Preview) v1.7.3172-preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.17763.1518
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.3172.0

Windows 10, Version 1809 (OS Build 17763.5206)

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Jan 3, 2024
@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. PowerShell Issue related to WinGet PowerShell Module or cmdlet and removed Needs-Triage Issue need to be triaged labels Jan 3, 2024
@norsemangrey
Copy link
Author

I've tested with v1.6.3482 as well, but result is the same.

@denelon
Copy link
Contributor

denelon commented Jan 5, 2024

I'll dig in and see if I can reproduce this bug. Do you know if the PowerShell installation was via the .msix installer or the .msi installer? I recently encountered an issue where the .msix PowerShell can't correctly communicate to WinGet via the COM APIs. I'd like to see if that's what is happening in this case or if this is a different bug.

@norsemangrey
Copy link
Author

norsemangrey commented Jan 7, 2024

I'm in need to install it programatically for which I am trying to create a PS script to do the job. I'm installing winget-cli using DISM with the following command:

Add-AppxProvisionedPackage -Online -PackagePath $DesktopInstallerOutputFile -LicensePath $LicenseFileOutputPath

where $DesktopInstallerOutputPath is the .msixbundle file. And as mention, using winget works fine. After that I'm installing the PowerShell module like this:

Install-Module -Name Microsoft.WinGet.Client

@denelon
Copy link
Contributor

denelon commented Jan 8, 2024

What output do you get for:
Get-AppxPackage Microsoft.PowerShell

@norsemangrey
Copy link
Author

norsemangrey commented Jan 9, 2024

Running it in PowerShell 7 I am getting an error message:

Get-AppxPackage: The 'Get-AppxPackage' command was found in the module 'Appx', but the module could not be loaded due to the following error: [Operation is not supported on this platform.

Might be related to this issue?

As I am setting up the machine programmatically from scratch I have to install WinGet using Appx through PS 5 ... then use WinGet to install PS 7 and finally the WinGet PowerShell Client in PS 7 (this is the only approach I have found). But apparently there is some disconnect the due to the mentioned issue with Appx.

Edit: Actually the issue is the same even if I install PowerShell 7 first and the install Winget and then finally Microsoft.WinGet.Client from PS7.

@RalfReddings
Copy link

RalfReddings commented Jan 26, 2024

I am getting the same error when I run Get-WinGetPackage:

Get-WinGetPackage: An error occurred while connecting to the catalog.

I hope this gets fixed soon. Cheers.

@denis-komarov
Copy link

As a workaround, you can explicitly specify the source:

Find-WinGetPackage -Name Adobe -Source winget

The result will be like this:

Name                      Id                          Version      Source
----                      --                          -------      ------
Adobe Acrobat DC (64-bit) Adobe.Acrobat.Reader.64-bit 21.011.20039 winget
Adobe Acrobat Reader DC   Adobe.Acrobat.Reader.32-bit 21.011.20039 winget
Adobe Connect             Adobe.AdobeConnect          21.11.22     winget

@norsemangrey
Copy link
Author

As a workaround, you can explicitly specify the source:

I'm still getting the same error even when specifying the source, so that must be related to a different issue.

> Find-WinGetPackage -Name Adobe -Source winget
Find-WinGetPackage: An error occurred while connecting to the catalog.

@RalfReddings
Copy link

As a workaround, you can explicitly specify the source:

Find-WinGetPackage -Name Adobe -Source winget

The result will be like this:

Name                      Id                          Version      Source
----                      --                          -------      ------
Adobe Acrobat DC (64-bit) Adobe.Acrobat.Reader.64-bit 21.011.20039 winget
Adobe Acrobat Reader DC   Adobe.Acrobat.Reader.32-bit 21.011.20039 winget
Adobe Connect             Adobe.AdobeConnect          21.11.22     winget

Can confirm this works for me. It will do until a fix released. Thank you.

@ameltzer-MSFT
Copy link

I am able to repro this issue as well, but only on 1809 versions of Windows.

@denelon
Copy link
Contributor

denelon commented Jul 26, 2024

I'm hoping this has been resolved in the latest version of the Microsoft.WinGet.Client module. Can anyone confirm either way?

@denelon denelon added the Needs-Author-Feedback Issue needs attention from issue or PR author label Jul 26, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the No-Recent-Activity Issue has no recent activity label Aug 3, 2024
@denis-komarov
Copy link

denis-komarov commented Aug 20, 2024

@denelon
The error has not been resolved and is reproduced on the latest version of the module 1.8.1911

Import-Module -FullyQualifiedName 'D:\d\run\powershell\modules\Microsoft.WinGet.Client' -Scope Global
( Get-Module -Name 'Microsoft.WinGet.Client' ).Version
Find-WinGetPackage -Name Adobe

The result will be like this:
issue_4022_screenshot

@denis-komarov
Copy link

@denelon
The problem was solved after installing the latest stable version 1.8.1911 of the WinGet Client.
Probably the problem was that the module was using an outdated version of the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback Issue needs attention from issue or PR author PowerShell Issue related to WinGet PowerShell Module or cmdlet
Projects
None yet
Development

No branches or pull requests

5 participants