If you see the error message “Failed in attempting to update the source: winget”, this usually indicates a problem with updating the Windows Package Manager (also known as winget) repository source.
This error can occur when updating the source, upgrading, searching for packages and more. It's not always clear why this error occurs, but here are some common problems.
WinGet repository source is blocked by a firewall.
Firewalls are designed to protect your network by blocking access to certain external resources. However, sometimes a firewall can also block legitimate connections to the WinGet repository source. Adjusting the firewall settings or temporarily disabling the firewall can help resolve this problem.
There are references in the HOSTS file that block access to the repository resource.
The HOSTS file on Windows systems can be used to influence DNS translations. If any rules have been added that point to the domains of the WinGet repository resource, this may block access to these resources. Checking and modifying the HOSTS file may be necessary.
There is an outage at the repository source, usually on Microsoft's servers.
Occasionally, Microsoft's servers hosting the WinGet repository source may experience outages. This can cause temporary access problems. In such cases, it is advisable to try again later or check the status of the Microsoft servers via their official status pages or social media channels.
An outdated version of winget is installed.
As with many software, older versions of WinGet may have difficulty communicating with newer server infrastructures or supporting recently added features. Updating to the latest version of WinGet may resolve these issues.
In addition to these common issues, network configuration errors, user rights issues, or conflicts with other installed software can also contribute to this error message. Methodically troubleshooting these issues can help identify and resolve the underlying cause. Checking log files, running winget with elevated privileges, or temporarily disabling antivirus software are some of the steps you can take to resolve the problem.
Failed in attempting to update the source: winget error message
Download sources.msix
One of the most commonly reported solutions is to manually download and install “sources.msix” via the Microsoft Edge browser.
Open the Microsoft Edge browser and download: https://cdn.winget.microsoft.com/cache/source.msix
Open the folder where the file was downloaded. Then right-click on “sources.msix” and click “Install”.
Windows Package Manager can now be updated. To do this, click on the “Update” button.
Confirm again by clicking “Reinstall”.
Now restart your computer. The issue “Failed in attempting to update the source: winget” should now be resolved.
Modify HOSTS file
Another solution is to modify the HOSTS file in Windows. Adding a line with Microsoft's IP address and hostname also solved the problem.
Click on “Search” in the taskbar. Then search for “notepad”. Right-click on it and click “Run as administrator”.
Click on “File” in the menu and then on “Open”. Go to the folder c:\windows\system32\drivers\etc\. Change “Text Files (*.txt)” to “All Files” and to the HOSTS file.
Add the following line, and press CTRL +S to save. Then close notepad.
152.199.21.175 cdn.winget.microsoft.com
Now restart your computer. After the restart, check whether the error message “Failed in attempting to update the source: winget” has been resolved.
I hope this helped you. Thank you for reading!