Skip to content

[BUG]: Winget-Update fails on packages with unknown versions #177

Description

@Magnetarman

Preliminary Checks

  • I checked that no existing issue reports the same problem.
  • I am using the latest available WinToolkit version.

Bug Description

When the Winget-Update function in the PowerShell profile attempts to upgrade the WinGet package Blizzard.BattleNet, the operation fails with a "package version not determinable" error and returns exit code -1978335189. The package is not upgraded, and the user is left with no path forward other than manually re-running winget upgrade with extra arguments.

The failure is not exclusive to Battle.net: any package whose installed version is not properly versioned in the WinGet source triggers the same error.

Steps to Reproduce

  1. Install Blizzard.BattleNet (or any package whose installed version is reported as "Unknown" by WinGet).
  2. Open a PowerShell session with the WinToolkit profile loaded.
  3. Run Winget-Update.
  4. When prompted, paste Blizzard.BattleNet as one of the package IDs to upgrade and press Enter on an empty line to start.
  5. Observe the upgrade attempt.

Expected: the package is upgraded (or a graceful fallback handles the unknown-version case).
Actual: the upgrade fails immediately with a version-determination error.

Expected Behavior

The function should detect packages whose installed version cannot be determined by WinGet, automatically retry the upgrade with the --include-unknown argument, and report success — matching the pattern already used for the incompatible-installation-technology reinstall flow.

Actual Behavior

🔄 Upgrading Blizzard.BattleNet...
Non è possibile determinare il numero di versione di questo pacchetto. Per aggiornarlo comunque, aggiungere l'argomento --include-unknown al comando precedente.
❌ Blizzard.BattleNet upgrade failed (code -1978335189).

### Windows OS Version

Windows 11 25H2

### PowerShell Version

PowerShell 7.4+ (Core)

### PowerShell Profile Version

2.6.0.6

### Bug Type

- [ ] This is a Windows bug caused by a specific Windows version.

### Log Attachment (Required)

- [x] I generated and attached the `.zip` log file below.

### Additional Context

- The error message contains a mojibake character (`├¿`) which is the UTF-8 byte sequence for the en-dash (`–`) being mis-decoded — minor console/locale issue, not blocking.
- Related: the same `-1978335189` exit code is already handled in `Update-Pwsh` for `Microsoft.PowerShell` (incompatible-tech reinstall flow) and could be unified with the same helper.
- Fix should be DRY: extract a `Test-WingetUnknownVersion` / `Invoke-WingetUnknownVersionRetry` pair to keep `Winget-Update` and `Update-Pwsh` consistent.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions