winget-cli: Failed in attempting to update the source: winget
Brief description of your issue
I don’t know exactly when this started to happen, but I’m pretty sure that it was after I ran some cleanup with CCleaner and BCUninstaller when I had some issues to uninstall a few of my programs.
Now, every time I try to run winget install
or winget upgrade
it fails with this error. When install
, it fails but continues anyway.
I know this was probably my fault, but still, I think it would help the community to share what to do when it happens, or better yet: to allow winget
to recover itself when such things happens.
I tried to do some things already, such as upgrading, downgrading (the winget cli), but none helped. I also tried to uninstall the “App Installer” but I could not find a way to do it, so that I could try to reinstall.
I also noticed that a previous issue was opened for this, but the solution mentioned isn’t working for me: https://github.com/microsoft/winget-cli/issues/1066
Steps to reproduce
I’m not sure. But I would be happy to provide any information required.
Expected behavior
To not fail with this error.
Actual behavior
➜ winget upgrade --all
Failed in attempting to update the source: winget
No applicable update found.
Environment
➜ winget --info
Windows Package Manager v1.1.12702
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.22000.282
Package: Microsoft.DesktopAppInstaller v1.16.12702.0
Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
Links
---------------------------------------------------------------------------
Privacy Statement https://aka.ms/winget-privacy
License Agreement https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 5
- Comments: 153 (18 by maintainers)
why the bug issue is closed without fixing it? clean installing windows os isn’t a reasonable solution.
Can you run that command with
--verbose-logs
and post the log file?Also: does
winget source reset --force
fix it? I kind of doubt it, but it seems to be able to recover from other weirdness.winget source update --name winget
gets metried all methods. It seems most of the servers are down. msstore working fine.
💡Workaround/manual fix is point cdn.winget.microsoft.com to a cache IP with a still working source.msix file (152.195.19.97): 1 - Open
C:\Windows\System32\drivers\etc\hosts
with a text editor as administrator (e.g., Notepad/VS Code). 2 - Add it to the end of the file:152.195.19.97 cdn.winget.microsoft.com
3 - Save the file. 4 - Run it as administrator:winget source reset --force
All, we had a couple of pesky nodes and had to get our CDN provider to flush them. We’ve also deployed changes to include a purge after each publish run at about 5:00 PM Pacific yesterday. We’re keeping an eye on any further reports of the zero-byte file being served.
Thank you for all the reports with IP addresses. These have been very helpful for us to track down the offending endpoints.
I concur:
I’m in the UK, and also getting:
Downloading https://cdn.winget.microsoft.com/cache/source.msix results in a 0 byte file.
Just hit this issue, and the folks above with the temporary host entry solution got it right. They are having CDN issues (image below), except the ip that worked for me is the following:
152.199.52.147 cdn.winget.microsoft.com
Just for completeness, I also tried to
WSReset.exe
and aforEach
PowerShell snippet to restore the default Windows Appx packages. None worked.So I ended up by doing a clean install (and of course it’s working now).
Lesson taken: never make registry changes without a backup.
This works for me as a temporary fix for now. Steps:
For me, simpler fix:
winget source update
from elevated command prompt.Non elevated had this:
Elevated:
Non elevated prompt, after elevated source update (no “failed in attempting to update the source” line):
Issue is still persistent: winget source update Updating all sources… Updating source: msstore… Done Updating source: winget… Cancelled
Ah I see what you mean.
It saves a few temporary files to
C:\Windows\Temp
but the actual source file is saved toC:\Users\%USERNAME%\AppData\Local\Temp\WinGet
and then provisioned viaAdd-AppxPackage
.I’m not sure what exactly is wrong with your system, but winget is failing to deploy the latest source file. Here are some things that might help you recover:
🪟 + i
) > Apps > Installed Apps b. Search forWindows Package Manager Source (winget)
c. Click the 3 dots on the right > Advanced Options d.Reset
the package (you could try Repair but Reset is a bigger hammer and there is no data to lose) e. This will attempt to re-register the package with the system and hopefully make things happy again.Uninstall
right there. b. Orwinget source remove winget
a. This will attempt to actually remove the existing source package from your system.I agree that there is potentially something that we could do here to recover in a more automated fashion, although it would most likely be automating the removal to hopefully enable a new installation to just work. If that doesn’t do it we would probably need to understand what was actually wrong to be able to mitigate.
Since yesterday I am having this issue too…
winget source update,no effect winget source reset --force,no effect
download and install https://cdn.winget.microsoft.com/cache/source.msix still has no effect
@MadSpindel
C:\Users\%USERNAME%\AppData\Local\Temp\WinGet
winget source update
(Kudos to @biyiklioglu for the solution)
I recently ran into this error message after installing WingetUI. If installed, your attempt to run
winget
from shell may collide with a sub-process ofwinget
under an active WingetUI instance.Exit one of the instances, such as WingetUI to avoid this message in shell…and likely vice-versa.
We’re working to renew the certificate:
same issue
I closed the issue because in my case, other parts of Windows (apart from Winget) were also broken as mentioned here. Is it your case as well?
I just managed to fix this by installing the pre-release from https://github.com/microsoft/winget-cli/releases
Ok, so for everyone who is here right now, having the exact same issue as everyone else, read the pinned issue #3652 😄
Also having the same issue… Going and manually downloading/installing from https://cdn.winget.microsoft.com/cache/source.msix seems to update the source (New updates are available afterwards with
winget update
) But runningwinget source update --name winget
still gets meCancelled
errorOne interesting thing to note is that https://cdn.winget.microsoft.com/cache/source.msix sometimes seems unavailable, I have to try ~2-3 times to download it.
I also think this is a problem with the upstream repository, as this appears to have started sometime yesterday for everybody at around the same time that the App Installer package was updated. The error is happening to me somewhat randomly; currently it’s working if I run
winget upgrade
, but some of the admin commands are still failing with the “Cancelled” error.If you have tried all the suggestions on this issue and still could not solve the problem your issue could be caused due to wrong permissions on the winget installer download directory.
Symptoms:
winget update
with nonadmin user fails withFailed in attempting to update the source: winget
winget source update --name winget
with nonadmin user fails withCancelled
winget update
works fine with admin userCause:
Nonadmin user has no permissions to the winget installer download directory:
%TEMP%\WinGet
=C:\Users\%USERNAME%\AppData\Local\Temp\WinGet
May be related to #3322
Solution:
Correct the permissions on the
%TEMP%\WinGet
directory or simply delete it so it would be recreated.Thanks for the update.
Glad to help!
I’m getting a 0 byte file from
152.195.19.97
as well:re: sba923. The difference I noticed in your two images is the one that worked used ipv4, the broken one used ipv6. So I tried disabling ipv6 on my network adapter, and bingo, “winget source update” worked. Then re-enabled ipv6 and the “winget upgrade” was OK too - for a while, then started giving the “Failed in attempting to update the source: winget” warning again. Probably when the domain resolved to the ipv6 address again. So I THINK at least part of the issue is problems getting to their CDN over ipv6.
UPDATE: Windows 10 22H2 | PowerShell 7.3.0 | Location: France
Problem gone
Same issue here in Hungary. It’s just popped up since a few days ago.
Same issue, Vietnam.
Same issue, Eastern Coast USA
Guys, just in case you don’t know and you really depend on winget for whatever reason: you can manually clone the winget-pkgs repository and use winget install -m path/to/manifest/folder you want to install.
I can confirm that nothing works in Europe. I even added US IP but it didn’t change anything. Maybe a VPN works.
I turned on VPN and
winget upgrade
andwinget source reset --force
executed successfully. I tried a US and Japanese IP, both worked.Thanks man, it worked for me! I had the same error as OP
I’ve run first: “winget source update --name winget” and then “winget install --id GitHub.cli”
Thanks again.
So, I think in this sense, this bug isn’t much of Winget’s concern but rather Windows itself. As mentioned in https://github.com/microsoft/winget-cli/issues/1656#issuecomment-955080920, perhaps the best would be to report in the Windows Feedback Hub.
Unfortunately, no logs are shown, and the command does not help either.