microsoft / microsoft/winget-cli

[New Feature]: Automatically repair Microsoft.Winget.Source component if it is broken on a user's PC

Open
#6,015 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Command-Source Issue-Feature
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Description of the new feature/enhancement

My team has a tool that uses WinGet to install components. On a customer's PC, we observed this failure:

winget list --exact --id Microsoft.PowerShell --source winget --disable-interactivity --accept-source-agreements failed with return code 0x80073CFC System.Exception: winget list --exact --id Microsoft.PowerShell --source winget --disable-interactivity --accept-source-agreements failed with return code 0x80073CFC

The root cause of this issue was that Microsoft.Winget.Source was in a bad state, specifically we saw this:

Get-AppxPackage Microsoft.Winget.Source

Name              : Microsoft.Winget.Source
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : Neutral
ResourceId        :
Version           : 2025.115.913.49
PackageFullName   : Microsoft.Winget.Source_2025.115.913.49_neutral__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.Winget.Source_2025.115.913.49_neutral__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.Winget.Source_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
IsPartiallyStaged : False
SignatureKind     : Store
Status            : PackageOffline, DataOffline, NotAvailable

The customer was able to resolve this issue by manually removing and re-installing Microsoft.Winget.Source like this:

Get-AppxPackage Microsoft.Winget.Source | Remove-AppxPackage -AllUsers
Get-AppxPackage Microsoft.Winget.Source
Install-Module Microsoft.WinGet.Client -Force -Repository PSGallery
Repair-WinGetPackageManager -Force -Latest

It would be nice if WinGet could self-heal in this type of scenario. Otherwise each app that depends on WinGet would need to implement repair logic or the customer needs to discover how to do that themselves.

Proposed technical implementation details (optional)

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failing winget list --exact --id Microsoft.PowerShell --source winget command and inspect the reported Microsoft.Winget.Source package state. Review the Repair-WinGetPackageManager flow and the remove/reinstall commands; done means WinGet detects this broken state and repairs it without requiring each dependent application to implement repair logic.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, powershell
Domain
cli, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.