Winget Source Error: 'msstore server certificate did not match'
How to fix the 'Failed when searching source: msstore' error message when trying to install software using the winget package manager.

I just finished setting up a Windows Virtual Machine (VM), Windows 11 dev environment to be exact, using the Hyper-V Manager app.
The next thing I needed to do was install some packages using the winget package manager, starting with the git binary.
The installation should be as simple as typing the following command and pressing Enter.
winget install Git.Git
But it didn’t work as expected.
You see, I got an error message. There was something wrong with the Microsoft Store server certificate or something.
Here’s the full error message:
PS C:\> winget install Git.Git
Failed when searching source: msstore
An unexpected error occurred while executing the command:
0x8a15005e : The server certificate did not match any of the expected values.
The following packages were found among the working sources.
Please specify one of them using the --source option to proceed.
Name Id Source
-------------------
Git Git.Git winget
I’m not sure what’s wrong. This is the first time I’ve experienced it.
I didn’t have much time to figure out a permanent solution, but there is one thing you can try to resolve it.
One quick solution is to add the --source=winget parameter when running the winget installation command.
So I ended up installing git using this command:
winget install --source=winget Git.Git
The installation should then run normally, just like when you’re installing anything using winget on a regular PC.
Another option you can try is opening Microsoft Store and doing some installations and upgrades.
It’s important to have the latest version installed, especially the App Installer package (Microsoft.AppInstaller).
Once that’s done, open Terminal again and run winget upgrade.
If nothing is wrong, it’ll ask you to accept the Microsoft Store source agreement terms.
Just type Y and press Enter.
PS C:\> winget upgrade
The `msstore` source requires that you view the following agreements before using.
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
The source requires the current machine's 2-letter geographic region to be sent to the backend service to function properly (ex. "US").
Do you agree to all the source agreements terms?
[Y] Yes [N] No: Y
Then, the next time you try to install something using winget, it should work without any issues.
Thanks for reading this short article. If you have any questions, leave a comment below.
See you next time!


