winget-cli
winget-cli copied to clipboard
Getting "An error occurred while connecting to the catalog" on Find-WinGetPackage
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)
I've tested with v1.6.3482 as well, but result is the same.
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.
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
What output do you get for:
Get-AppxPackage Microsoft.PowerShell
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.
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.
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
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.
As a workaround, you can explicitly specify the source:
Find-WinGetPackage -Name Adobe -Source wingetThe 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.
I am able to repro this issue as well, but only on 1809 versions of Windows.
I'm hoping this has been resolved in the latest version of the Microsoft.WinGet.Client module. Can anyone confirm either way?
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