Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Package Issue]: Discord.Discord requires explicit targeting and upgrade fails with "Installer hash does not match" #136960

Open
2 tasks done
lackovic opened this issue Jan 29, 2024 · 32 comments
Labels
Error-Hash-Mismatch The InstallerSHA256 Hash specified in the manifest doesn't match with the InstallerURL hash Help-Wanted This is a good candidate work item from the community. Package-Update This package needs to be updated

Comments

@lackovic
Copy link

Please confirm these before moving forward

  • I have searched for my issue and not found a work-in-progress/duplicate/resolved issue.
  • I have not been informed if the issue is resolved in a preview version of the winget client.

Category of the issue

Installation issue.

Brief description of your issue

Discord upgrade with winget upgrade -h --all fails because it requires a explicit targeting.
Upgrading with explicit targeting fails with "Installer hash does not match"

Steps to reproduce

Run winget upgrade -h --all, then run winget upgrade -h Discord.Discord.

Actual behavior

After the first command the upgrade is not executed and I get the following message:

The following packages have an upgrade available, but require explicit targeting for upgrade:
Name    Id              Version  Available Source
-------------------------------------------------
Discord Discord.Discord 1.0.9012 1.0.9030  winget

After the second command the upgrade is not executed and I get the following error:

Found Discord [Discord.Discord] Version 1.0.9030
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://discord.com/api/downloads/distributions/app/installers/latest?channel=stable&platform=win&arch=x86
  ██████████████████████████████  91.7 MB / 91.7 MB
Installer hash does not match; this cannot be overridden when running as admin

Expected behavior

The upgrade succeeds after the first command, or at least after the second.

Environment

Windows Package Manager v1.6.3482
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.3085
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3482.0

Screenshots and Logs

WinGet-2024-01-29-11-47-13.285.log
WinGet-2024-01-29-11-47-20.241.log

@lackovic lackovic added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jan 29, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Triage This work item needs to be triaged by a member of the core team. Package-Update This package needs to be updated Error-Hash-Mismatch The InstallerSHA256 Hash specified in the manifest doesn't match with the InstallerURL hash and removed Issue-Bug It either shouldn't be doing this or needs an investigation. labels Jan 29, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@lackovic
Copy link
Author

Discord is not running while doing the upgrade.

@lackovic
Copy link
Author

Can somebody explain or point to a page that explains why some apps require explicit targeting?

@kumarchandresh
Copy link

kumarchandresh commented Jan 29, 2024

Direct install also failed

❯ winget install --source winget --scope user --exact --id Discord.Discord
Found Discord [Discord.Discord] Version 1.0.9030
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://discord.com/api/downloads/distributions/app/installers/latest?channel=stable&platform=win&arch=x86
  ██████████████████████████████  91.7 MB / 91.7 MB
Installer hash does not match.

@stephengillie
Copy link
Collaborator

stephengillie commented Jan 29, 2024

Can somebody explain or point to a page that explains why some apps require explicit targeting?

This might be through pinning.

Use the --include-pinned argument with winget upgrade --all to include any pinned packages.

@stephengillie stephengillie removed the Needs-Triage This work item needs to be triaged by a member of the core team. label Jan 29, 2024
@Exorcism0666
Copy link
Contributor

@PckgrBot, there was already a pull request. #136871 (remove old version + adding x64)

@PckgrBot
Copy link
Contributor

@PckgrBot, there was already a pull request. #136871 (remove old version + adding x64)

Apologies, I didn't see yours. I did try to add x64 in and the link wasn't working. Mayeb I had the wrong one?

@lackovic
Copy link
Author

This might be through pinning.

I don't have any pins:

> winget pin list
There are no pins configured.

Upgrading with explicit targeting works now:

> winget upgrade -h Discord.Discord
Found Discord [Discord.Discord] Version 1.0.9031
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://dl.discordapp.net/distro/app/stable/win/x86/1.0.9031/DiscordSetup.exe
  ██████████████████████████████  91.7 MB / 91.7 MB
Successfully verified installer hash
Starting package install...
Successfully installed

@Showfom
Copy link

Showfom commented Feb 29, 2024

Can not upgrade Discord.Discord now:

> winget upgrade -h Discord.Discord
The package cannot be upgraded using winget. Please use the method provided by the publisher for upgrading this package.

@sba923
Copy link

sba923 commented Mar 10, 2024

Discord has auto-updated itself from 1.0.9034 to 1.0.9035, yet winget list discord reports this:

PS> winget list discord
Name    Id              Version  Available Source
-------------------------------------------------
Discord Discord.Discord 1.0.9034 1.0.9035  winget

@ratheader
Copy link

Obviously they don't want to keep their installation package compatible with winget. So why don't they take themselves out of it? It's annoying to have the updates displayed in Winget but not be able to run them. Those at Discord might find that funny. I think it sucks.

@tessharp
Copy link

tessharp commented Apr 22, 2024

Could it be that all of the Discord packages were marked in the manifest with the flag: UpgradeBehavior: deny? I tried to look into why these changes were made by @Trenly but unfortunately can't get any details on why this behavior was configured.

Edit: My gut feel is that apps that requires "approval" of Terms of Service after install, are not included in winget. This happened to VMware Workstation a while back IIRC (it has been added ever since... but it's a bit confusing ngl)

@Trenly
Copy link
Contributor

Trenly commented Apr 22, 2024

Could it be that all of the Discord packages were marked in the manifest with the flag: UpgradeBehavior: deny? I tried to look into why these changes were made by @Trenly but unfortunately can't get any details on why this behavior was configured.

Edit: My gut feel is that apps that requires "approval" of Terms of Service after install, are not included in winget. This happened to VMware Workstation a while back IIRC (it has been added ever since... but it's a bit confusing ngl)

No, that isn’t the issue. The deny behavior was set because Discord has its own auto updater and the updater doesn’t write the new version to registry; attenpting to update Discord using winget would re-install and erase user settings

@anonymouswhac
Copy link

The package cannot be upgraded using winget. Please use the method provided by the publisher for upgrading this package.
Process Exit Code : -1978334956
Process End Time : 2024/5/14 0:09:27

@seangibbz
Copy link
Contributor

This issue is due to poorly-configured installer manifests using the dynamic latest URL, as opposed to a static version-specific URL.

i.e. : https://dl.discordapp.net/distro/app/stable/win/x86/1.0.9030/DiscordSetup.exe for version 1.0.9030

This appears to have been fixed with the current-version manifests.

@stephengillie
Copy link
Collaborator

Since the above PRs have been merged, I'll assume that this Issue is complete. If this is in error, please @ me and I'll reopen.

@crazyuploader
Copy link

Still getting the error @stephengillie

⮞  winget upgrade
No installed package found matching input criteria.

The following packages have an upgrade available, but require explicit targeting for upgrade:
Name    Id              Version  Available Source
-------------------------------------------------
Discord Discord.Discord 1.0.9160 1.0.9161  winget

⮞  winget upgrade Discord.Discord
The package cannot be upgraded using winget. Please use the method provided by the publisher for upgrading this package.

@Showfom
Copy link

Showfom commented Sep 1, 2024

Still getting the error @stephengillie

⮞  winget upgrade
No installed package found matching input criteria.

The following packages have an upgrade available, but require explicit targeting for upgrade:
Name    Id              Version  Available Source
-------------------------------------------------
Discord Discord.Discord 1.0.9160 1.0.9161  winget

⮞  winget upgrade Discord.Discord
The package cannot be upgraded using winget. Please use the method provided by the publisher for upgrading this package.

Yes same here. I have to use winget uninstall Discord.Discord and then winget install Discord.Discord for upgrading Discord.

@stephengillie stephengillie reopened this Sep 3, 2024
@stephengillie stephengillie added Help-Wanted This is a good candidate work item from the community. and removed In-PR labels Sep 10, 2024
@woctezuma
Copy link

woctezuma commented Sep 12, 2024

I have found out about this issue after installing UniGetUI to update my softwares with winget, and the only software which had an issue updating was Discord.

I wonder if this could be due to the installation of plugins, such as Vencord, I have not checked with a vanilla Discord installation.

Meanwhile, uninstalling then installing Discord worked to update the software. I had to install Vencord again afterwards.

@CheckYourFax
Copy link

CheckYourFax commented Nov 20, 2024

No, Discord has no proper version tracking as it's a React app running on Electron. It self-updates the moment you start it.

It doesn't track installs, because it just updates the actual files. This makes version tracking impossible.

The installer however is updated every time a new build is out, and that version is only tracked on install.

If you constantly update using the installer, you have to redownload a bunch of files over and over again, even if not updated. Therefore it's not recommended to update Discord outside of its own updater.

@SpecterShell
Copy link
Contributor

No, Discord has no proper version tracking as it's a React app running on Electron. It self-updates the moment you start it.

It doesn't track installs, because it just updates the actual files. This makes version tracking impossible.

The installer however is updated every time a new build is out, and that version is only tracked on install.

If you constantly update using the installer, you have to redownload a bunch of files over and over again, even if not updated. Therefore it's not recommended to update Discord outside of its own updater.

Discord uses Squirrel Installer for installation (probably with the help of electron-builder). Although Squirrel Installer provides the methods to check version and perform self-update, Discord implements its own logic for updating that is independent of Squirrel.

Discord would use delta update only if it is one version behind, otherwise it will download the full archive, depending on how the update source define the strategy: https://updates.discord.com/distributions/app/manifests/latest?channel=stable&platform=win&arch=x64

@levicki
Copy link

levicki commented Nov 30, 2024

I would add that the way Discord installs itself is causing an issue with Windows system tray icon hide / show mechanism.

Namely, they install every update in a new path which contains a version number. Since the executable path changes, Windows thinks discord.exe is a new application every time it's updated, and if you elected to always show the icon in the tray it is hidden again.

Worse yet, for each update, there's a new registry key that Windows Explorer creates to track this icon state so it's basically trashing your registry and slowing down Windows Explorer (takes longer and longer to check which icons need to be shown or hidden as there are more and more keys after each update).

I reported that issue to them but they said they would need some time to understand the problem and see if they can fix it despite the solution (no version number in path) being obvious. It's been more than a year since then. Bunch of amateurs if you ask me.

As for problems updating Discord using winget, I am getting the following:

The package cannot be upgraded using winget. Please use the method provided by the publisher for upgrading this package.

When I run Discord it doesn't show the update that winget is showing and it's not updating itself.

Before this, I have uninstalled Discord, installed it using winget, and after it updated itself once using its built-in updater now I can't upgrade it anymore using winget.

Just leaving this here in case anyone else finds the info useful.

@ctyotgomrbwoaujv
Copy link

I'm having the same issue, has there been a solution?

@CheckYourFax
Copy link

The only solution is discord fixing their update logic and not place their .exe in a new folder every time.

@treysis
Copy link
Contributor

treysis commented Dec 20, 2024

The solution would be to kick Discord off of Winget until they make their app compatible with the install system. But this seems unfavorable by many here, unfortunately.

@CheckYourFax
Copy link

CheckYourFax commented Dec 21, 2024

The installer works fine. Just updating doesn't. It would remove the ability for scripted/unattended installation of software using WinGet. I'm against removing it for this reason.

It would be better if someone with some sort of influence can ask the Discord team what's up with their update system, especially since it actually does create insane amounts of registry keys over time.

Its update system does not play well with how Windows tracks installations and Windows its ecosystem: Windows pretty much expects the main .exe to always be in the same location. It is not. Every update the main .exe moves to a new folder, and that's how versions are tracked.

Windows does not play well with this sort of update mechanism for several reasons:

  • Windows tray icon visibility resets back to Off every update.
  • There are new registry keys added every update (and there's several updates a week).

And there's going to be a lot more downsides to moving the .exe after every update. Whoever came up with this needs a boot up their arse.

@rsforbes
Copy link

@CheckYourFax -

Whoever came up with this needs a boot up their arse.

Booting Discord off WinGet is the "boot up their arse." 😂

@treysis
Copy link
Contributor

treysis commented Dec 21, 2024

What @rsforbes is saying! I don't know anyone with influence and I am pretty sure they won't listen to such feedback at this point in time, as currently there's no incentive for them to change it. Kicking it off Winget could change that. I don't know how they came up with their updating system but I guess they were just doing what was easy and now they're used to it, so why change it?

Imagine some devs would go to Debian and ask for their package to be included, but not adhering to the standards. Yes, you can have your custom installers and updates on Debian etc. but then you simply won't be listed in the package management.

But they want their cake and eat it too! And I think Winget should stop catering to everyone just because.

@oliver-pola
Copy link

oliver-pola commented Jan 22, 2025

I used to avoid this problem by running a script that reads the version from Discord.exe and writes it to registry installer data.

But for some reason, for some months now, the version listed by winget is always 1 or 2 numbers ahead of a freshly auto-updated discord.

As of now Discord auto-updated to 1.0.9177 but winget claims 1.0.9179 to be latest.

I don't really care about a fully automated update, but I do care about a quick and easy response from winget update to show everything is up to date.

@jason19970210
Copy link

Hello folks,

I just found a basic command to reinstall the "Discord.Discord" application for getting the latest version:

> winget install --force Discord.Discord

And here is the output:

PS C:\Users\user> winget upgrade --all
No installed package found matching input criteria.

The following packages have an upgrade available, but require explicit targeting for upgrade:
Name    Id              Version  Available Source
-------------------------------------------------
Discord Discord.Discord 1.0.9178 1.0.9180  winget
3 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
1 package(s) are pinned and need to be explicitly upgraded.

PS C:\Users\user> winget install --force Discord.Discord
Found Discord [Discord.Discord] Version 1.0.9180
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Successfully installed

Hope this can help through it's not the proper step for winget upgrade --all command

@tessharp
Copy link

tessharp commented Jan 29, 2025

@jason19970210 Problem with that approach is that it will override your settings, meaning that you'd have to configure your Windows preferences all over again.

After looking at this app in full, and with some of the comments here, here is a summary on what's causing this issue:

  • The actual Discord application is installed under C:\Users\<username>\AppData\Local\Discord\app-<version number>
  • Discord actually invokes the Update.exe executable located at C:\Users\<username>\AppData\Local\Discord\ to START the client with the following flags: C:\Users\<username>\AppData\Local\Discord\Update.exe --processStart Discord.exe
  • This way, the updater always starts from a hard path, and after fetching the new version number from its server, it either a) start it from the known app-<version number> folder, or b) there will be a new app-<version number> folder where the application is started from

This actually causes issues for Windows, and how it handles updates overall:

  • The updater never updates the registry keys at all, which are located at \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Discord. This doesn't even make sense, because these keys are under the "User" context, and the updater will have the rights to update them.
  • Since the application changes its path, the preferences on whether you decided to hide/unhide the app icon from the task bar get jeeted out the window because now it's technically a new application, running from a different path
  • Reinstalling will nuke your local settings (explained it at the very begining). It completely disregards whether you had a previous install or not.

This is terrible deployment practice because it's not keeping track of versioning, when it is more capable of, and since it keeps moving its own path, some of your settings will be gone after an update. This is all on Discord to fix, because the mechanisms to be compliant are already on Windows.

I tried notifying Discord about this, but their feedback process forced me to report a bug and then I got ghosted. Would be nice to see if there is someone over there that could take a note of this and make Discord behave like a standard application.

@treysis
Copy link
Contributor

treysis commented Jan 29, 2025

Separate folder for each update is actually the way Squirrel updates work. But Squirrel also updates the registry keys. It seems that Discord is using an unorthodox way with Squirrel, circumventing the nor.al update routine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error-Hash-Mismatch The InstallerSHA256 Hash specified in the manifest doesn't match with the InstallerURL hash Help-Wanted This is a good candidate work item from the community. Package-Update This package needs to be updated
Projects
None yet
Development

Successfully merging a pull request may close this issue.