You typed winget search vscode and got "Failed when searching source: winget" or just an empty result. Frustrating — but the fix is usually one of 8 things. Here's how to diagnose and solve each in under a minute.
Quick diagnostic — try this first
winget --info
This shows the configured sources. You should see:
Name : winget
Type : Microsoft.PreIndexed.Package
Argument : https://cdn.winget.microsoft.com/cache
Identifier : Microsoft.Winget.Source_8wekyb3d8bbwe
If the winget source is missing or marked as disabled, jump to Fix 2. Otherwise read on.
Fix 1 — Reset the source index (solves 70% of cases)
The local catalog index gets corrupted or stuck on an old version. Reset:
winget source reset --force
winget source update
Now retry:
winget search vscode
If you get results — done. The reset re-downloads a fresh ~10 MB index from Microsoft's CDN.
Fix 2 — Re-add the missing winget source
If winget source list shows no winget source (only msstore or empty), re-register it:
winget source add --name winget --arg https://cdn.winget.microsoft.com/cache --type Microsoft.PreIndexed.Package
winget source update
This is the same default source Microsoft ships. After update, search again.
Fix 3 — Accept agreements
On a fresh winget install or after a reset, source-source agreements need to be accepted before search works:
winget source update --accept-source-agreements
Or globally on any command:
winget search firefox --accept-source-agreements
If you've never used winget before, this is usually the answer.
Fix 4 — Check internet access to Microsoft's CDN
winget pulls the index from https://cdn.winget.microsoft.com/cache. Verify it's reachable:
Test-NetConnection cdn.winget.microsoft.com -Port 443
You want TcpTestSucceeded : True. If False, the host is blocked — could be:
- Corporate firewall (ask IT to whitelist
*.winget.microsoft.com) - Misconfigured DNS (try
nslookup cdn.winget.microsoft.com) - Antivirus blocking outbound HTTPS
- VPN routing the request to a region with restrictions
Fix 5 — Proxy configuration
On corporate networks, winget needs to know your HTTP proxy. Set it explicitly:
winget settings --enable LocalManifestFiles
Then edit %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json:
{
"$schema": "https://aka.ms/winget-settings.schema.json",
"network": {
"downloader": "wininet",
"doProgressTimeoutInSeconds": 30
}
}
The wininet downloader respects Windows system proxy. The default do (Delivery Optimization) ignores proxy and tries direct connect — fails on most corp networks.
Fix 6 — TLS / SSL certificate errors
If you see "The remote certificate is invalid" or TLS handshake failures, your Windows certificate store is out of date. Refresh it:
certutil -generateSSTFromWU "$env:TEMP\roots.sst"
Import-Certificate -FilePath "$env:TEMP\roots.sst" -CertStoreLocation Cert:\LocalMachine\Root
You need to run PowerShell as Administrator for this. Reboot after, then retry winget.
Fix 7 — Reinstall App Installer
If reset and source add don't help, App Installer itself may be corrupted:
Get-AppxPackage Microsoft.DesktopAppInstaller | Remove-AppxPackage
Then reinstall from Microsoft Store (search "App Installer" → Get) or download the latest .msixbundle from github.com/microsoft/winget-cli/releases.
Detailed reinstall steps: How to install winget on Windows 10.
Fix 8 — Search syntax issues
Sometimes winget search "works" but returns less than you expect. A few syntax tips:
Partial matches need at least 2 characters:
# Too short, may return nothing
winget search a
# Works
winget search au
Use quotes for multi-word:
winget search "visual studio"
Filter by tag:
winget search --tag database
Filter by publisher:
winget search --source winget --publisher "Mozilla"
Exact ID lookup (not search):
winget show --id Microsoft.VisualStudioCode
If winget show returns the package detail but winget search doesn't — your search term just doesn't match the package's name, tag, or description. Browse winget.tech instead to find the right ID visually.
Still broken? The nuclear option
If you've tried all 8 fixes and search still fails:
# Wipe everything
winget source remove --name winget
winget source remove --name msstore
Remove-Item "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source*" -Recurse -Force
# Reinstall App Installer
Get-AppxPackage Microsoft.DesktopAppInstaller | Remove-AppxPackage
# (then install fresh from Store)
# Re-add source
winget source add --name winget --arg https://cdn.winget.microsoft.com/cache --type Microsoft.PreIndexed.Package
winget source update --accept-source-agreements
This is heavy-handed but works on every machine we've seen.
What's next?
- What is winget? → — primer
- How to install winget on Windows 10 → — fresh setup
- Winget commands cheatsheet → — every command
- How to update all apps with winget upgrade → — keep them current
