microsoft / microsoft/winget-cli

Use human-readable error codes when reporting out an error

Open
#5,419 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Current behavior

The winget CLI reports out an error code, like 1978335216 (from the list here https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md). Customers have to either run winget error <error number/code> to understand the error code, or they have to look up the error code in the abovementioned github link.

Proposed behavior:
To make it easy for customers to understand the error without additional steps, we propose adding an errorDetails field, with the human readable error detail from https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md) in the cli output.

Example error:
[2025-03-20T18:28:48.236360+00:00] Running package install: Postman.Postman
[2025-03-20T18:28:49.372763+00:00] {
[2025-03-20T18:28:49.372789+00:00] "Id": "Postman.Postman",
[2025-03-20T18:28:49.372790+00:00] "Name": "Postman",
[2025-03-20T18:28:49.372792+00:00] "Source": "winget",
[2025-03-20T18:28:49.372793+00:00] "CorrelationData": "",
[2025-03-20T18:28:49.372794+00:00] "InstallerErrorCode": 0,
[2025-03-20T18:28:49.372797+00:00] "ExtendedErrorCode": {
[2025-03-20T18:28:49.372798+00:00] "ErrorCode": -1978335216,
[2025-03-20T18:28:49.372799+00:00] "TargetSite": null,
[2025-03-20T18:28:49.372800+00:00] "Message": "",
[2025-03-20T18:28:49.372801+00:00] "Data": {
[2025-03-20T18:28:49.372900+00:00] "Description": null,
[2025-03-20T18:28:49.372906+00:00] "RestrictedDescription": null,
[2025-03-20T18:28:49.372907+00:00] "RestrictedErrorReference": null,
[2025-03-20T18:28:49.372908+00:00] "RestrictedCapabilitySid": null,
[2025-03-20T18:28:49.372911+00:00] "__RestrictedErrorObjectReference": null,
[2025-03-20T18:28:49.372921+00:00] "__HasRestrictedLanguageErrorObject": false
[2025-03-20T18:28:49.372922+00:00] },
[2025-03-20T18:28:49.372923+00:00] "InnerException": null,
[2025-03-20T18:28:49.372926+00:00] "HelpLink": null,
[2025-03-20T18:28:49.372927+00:00] "Source": null,
[2025-03-20T18:28:49.372928+00:00] "HResult": -1978335216,
[2025-03-20T18:28:49.372930+00:00] "StackTrace": null
[2025-03-20T18:28:49.372931+00:00] },
[2025-03-20T18:28:49.372932+00:00] "RebootRequired": false,
[2025-03-20T18:28:49.372934+00:00] "Status": "NoApplicableInstallers"
[2025-03-20T18:28:49.372935+00:00] }

Proposed technical implementation details

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 reading doc/windows/package-manager/winget/returnCodes.md, which defines the error codes and human-readable details. Then trace where the winget CLI emits the shown structured error output and determine how an errorDetails field should be populated. Done means CLI errors expose the matching human-readable detail without requiring a separate lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, operating-systems
Issue type
Feature
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.