Fix Windows Package Manager 'Operation Failed' Errors
In this article
Yes—you can resolve the Windows Package Manager (winget) "Operation failed" message by clearing the local cache, updating winget, and verifying the package source configuration.
What You'll Need
- Windows 10 version 1809 or later (winget is built‑in from version 1809 onward)
- Administrator rights on the PC
- An active internet connection
- PowerShell or Command Prompt
- Optional: the latest Microsoft Store version of the App Installer package (contains the newest winget)
Step‑By‑Step
- Open PowerShell as Administrator. Right‑click the Start button, choose Windows PowerShell (Admin) or Terminal (Admin). This ensures winget can modify system‑wide files.
- Check the current winget version. Run
winget --version. If the version is older than the one listed on the official winget GitHub releases page, you should update. - Update winget via the Microsoft Store. Open the Microsoft Store, search for App Installer, and click Update if the button is available. The Store version always contains the latest winget binary.
- Clear the winget cache. In the same elevated PowerShell window, execute:
Remove-Item "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Cache" -Recurse -Force
This removes corrupted metadata that often triggers the "Operation failed" error. - Refresh the package sources. Run:
winget source reset --force
This forces winget to download fresh source files from the default Microsoft community repository. - Verify the source list. Execute
winget source list. You should see at least one entry named winget with a URL likehttps://cdn.winget.microsoft.com/cache. If the list is empty or shows an error, add the default source back with:winget source add -n winget -a https://cdn.winget.microsoft.com/cache - Run a test install. Try installing a small, well‑known package, for example:
winget install --id Microsoft.PowerToys
If the command completes without the "Operation failed" message, the issue is resolved. - If the error persists, reinstall App Installer. Open Settings > Apps > Apps & features, locate App Installer, click Uninstall, then reinstall it from the Microsoft Store. This replaces any corrupted executable files.
Common Mistakes
- Running winget without administrator rights when trying to modify system‑wide packages. The command will return "Operation failed" because it cannot write to protected folders.
- Deleting the wrong cache folder. The cache path is specific to App Installer; removing other %LOCALAPPDATA% folders can break unrelated apps.
- Using an outdated source URL. The default source URL changes occasionally; copying an old URL from a forum can cause validation failures.
- Skipping the
source reset --forcestep. Even after clearing the cache, stale source files may remain and continue to cause failures.
Tips
- Keep the Microsoft Store set to auto‑update so winget receives patches automatically.
- Run
winget upgraderegularly; it checks the source for newer versions and also validates the source integrity. - If you manage multiple PCs with Group Policy, ensure the policy Allow use of Windows Package Manager is enabled; otherwise winget commands are blocked silently.
- Use the
--verboseflag (e.g.,winget install --id Microsoft.PowerToys --verbose) to get detailed logs that pinpoint where the operation stopped.
Troubleshooting
If the steps above do not resolve the problem, follow this escalation path:
- Restart the Windows Management Instrumentation (WMI) service. In an elevated Command Prompt, type:
net stop winmgmt && net start winmgmt
WMI issues sometimes prevent winget from querying installed packages. - Check the Windows Update service. Winget relies on the same certificate store used by Windows Update. Ensure the service is running and that no pending updates are blocked.
- Inspect the winget log file. The log resides at
%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagLog\winget.log. Look for lines containingERRORorOperation failedto identify missing dependencies. - Temporarily disable third‑party antivirus. Some security suites intercept network calls made by winget and return generic failure messages. Disable the real‑time shield, retry the command, then re‑enable protection.
- Reset the App Installer package. Open PowerShell and run:
Get-AppxPackage Microsoft.DesktopAppInstaller | Reset-AppxPackage
This restores default configuration without removing user data. - Contact Microsoft Support. If none of the above works, gather the log file, your winget version, and Windows build number, then open a support ticket through the Feedback Hub.
Frequently Asked Questions
Why does winget say "Operation failed" only for certain packages?
That usually means the package metadata on the server is corrupted or the package requires a dependency that is not available on your system. Refreshing the source or updating winget often fixes it.
Can I use winget on Windows 7?
No. Winget requires Windows 10 version 1809 or later because it depends on the App Installer framework that does not exist on older OS versions.
Do I need to run winget source reset after every Windows Update?
Not normally. A reset is only necessary when you see repeated "Operation failed" messages after an update, indicating the source cache was not refreshed automatically.
Is it safe to delete the entire %LOCALAPPDATA%\Packages folder?
No. Deleting the whole folder removes data for many Store apps and can cause them to stop working. Only remove the specific Cache subfolder for App Installer as described.
What does the --silent flag do, and can it hide errors?
--silent suppresses interactive prompts but still logs errors to the console and the log file. It does not prevent the "Operation failed" message from appearing.
Will reinstalling winget affect installed applications?
Reinstalling the App Installer package does not uninstall applications that were installed via winget. It only replaces the winget executable and its cache.