microsoft / microsoft/winget-cli

Installed Package shows with 2 different ID's

Open
#5,097 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Brief description of your issue

This issue was noticed when installing package LGUG2Z.whkd. If we search for this package with command winget search --id lgug2z.whkd it shows the correct package. After installing the package it installs correctly and the app works fine, however there is something weird with the package ID.

Depending on the command used to list packages it shows a different ID, it shows an ID of another package from the same developer. If we then try to install that other package it fails saying it is already installed.

If after installing I run command winget list --id lgug2z.whkd it shows this (which is correct):

❯ winget list --id lgug2z.whkd
Name ID          Version Origin
-------------------------------
whkd LGUG2Z.whkd 0.2.2  winget

If instead I run the command winget list -q lgug2z or winget list --id lgug2z it shows this (which is not correct):

❯ winget list -q lgug2z
Name ID           Version Origin
--------------------------------
whkd LGUG2Z.masir 0.2.2  winget

There is another package from the same developer called masir which has the ID LGUG2Z.masir and somehow winget thinks that the whkd package has both IDs. So if we now try to install the masir package it won't be possible because it says that it is already installed (even though I've never installed it):

❯ winget install --id lgug2z.masir
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.

The packages' manifests seem to be fine, each one has a different ID and a different ProductCode, there was an issue on masir version 0.1.0 which had the same UpgradeCode as whkd had. Thinking that this could be the cause of the issue, a new version of masir (0.1.1) was released with a different UpgradeCode but the issue persists. Also from briefly looking at the code it doesn't seem that winget checks this upgrade code when it is searching for a single package so that shouldn't be an issue, it appears to check the ProductCode, ID, Name and Moniker which are all different between these two packages...

What else could be causing this confusion of IDs?

Steps to reproduce

winget install --id lgug2z.whkd
winget list --id lgug2z.whkd (shows correct ID)
winget list -q lgug2z (shows wrong ID)
winget install --id lgug2z.masir (fails because it thinks it is already installed)

Expected behavior

The ID should always be the one from the package manifest which in this case is LGUG2z.whkd. Winget shouldn't be changing or confusing this ID after install.

Actual behavior

Winget shows different IDs depending on the command used. So some part of code that searches for a package is matching the wrong package and returning the wrong ID.

Environment
Windows Package Manager v1.9.25200
Windows: Windows.Desktop v10.0.22631.4460
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.24.25200.0

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

Reproduce the behavior with the four listed winget commands, then compare how installed-package results are matched and displayed for LGUG2Z.whkd and LGUG2Z.masir. Inspect the manifests and the differing ProductCode and UpgradeCode values; done means each command consistently reports the manifest ID and does not treat the other package as installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.