winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

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

Open norsemangrey opened this issue 1 year ago • 10 comments

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)

norsemangrey avatar Jan 03 '24 15:01 norsemangrey

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

norsemangrey avatar Jan 05 '24 08:01 norsemangrey

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.

denelon avatar Jan 05 '24 22:01 denelon

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

norsemangrey avatar Jan 07 '24 08:01 norsemangrey

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

denelon avatar Jan 08 '24 17:01 denelon

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.

norsemangrey avatar Jan 09 '24 12:01 norsemangrey

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.

RalfReddings avatar Jan 26 '24 16:01 RalfReddings

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

denis-komarov avatar Jan 28 '24 21:01 denis-komarov

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.

norsemangrey avatar Feb 01 '24 08:02 norsemangrey

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.

RalfReddings avatar Feb 02 '24 13:02 RalfReddings

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

ameltzer-MSFT avatar Jun 29 '24 00:06 ameltzer-MSFT

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

denelon avatar Jul 26 '24 22:07 denelon

Hello @norsemangrey,

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

Template: msftbot/noRecentActivity