winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

`winget list --scope=machine` throws `0x80070005 : unknown error` when non-admin

Open apcsb opened this issue 1 year ago • 3 comments

Brief description of your issue

When winget list is used with the scope=machine in a non-admin context, instead of telling the user that they need admin it throws a red hot 0x80070005 : unknown error message

Steps to reproduce

Open a non-admin command prompt (tested in CMD.exe and Terminal/PowerShell) and run winget list --scope=machine

Result:

Failed to open the predefined source; please report to winget maintainers.
An unexpected error occurred while executing the command:
0x80070005 : unknown error

Expected behavior

Something that is not unknown error? A meaningful error message that the user needs admin rights?

Actual behavior

Failed to open the predefined source; please report to winget maintainers.
An unexpected error occurred while executing the command:
0x80070005 : unknown error

Environment

Windows Package Manager v1.4.10173
Windows: Windows.Desktop v10.0.19045.2604
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.10173.0

User Settings:

{
    "$schema": "https://aka.ms/winget-settings.schema.json",
    // For documentation on these settings, see: https://aka.ms/winget-settings
    // "source": {
    //    "autoUpdateIntervalInMinutes": 5
    // },
}

Logs:

2023-03-06 21:40:35.593 [CORE] WinGet, version [1.4.10173], activity [{751E8BB0-2E15-4F66-867B-65AC40F8CD5D}]
2023-03-06 21:40:35.594 [CORE] OS: Windows.Desktop v10.0.19045.2604
2023-03-06 21:40:35.594 [CORE] Command line Args: winget  list --scope=machine --id whatever
2023-03-06 21:40:35.594 [CORE] Package: Microsoft.DesktopAppInstaller v1.19.10173.0
2023-03-06 21:40:35.594 [CORE] IsCOMCall:0; Caller: winget-cli
2023-03-06 21:40:35.603 [CLI ] WinGet invoked with arguments: 'list' '--scope=machine' '--id' 'whatever'
2023-03-06 21:40:35.604 [CLI ] Found subcommand: list
2023-03-06 21:40:35.604 [CLI ] Leaf command to execute: root:list
2023-03-06 21:40:35.604 [CLI ] Executing command: list
2023-03-06 21:40:35.612 [REPO] GetCurrentSourceRefs: Source named 'microsoft.builtin.desktop.frameworks' from origin Default is hidden and is dropped.
2023-03-06 21:40:35.612 [REPO] Default source requested, multiple sources available, adding all to source references.
2023-03-06 21:40:35.612 [REPO] Adding to source references msstore
2023-03-06 21:40:35.612 [REPO] Adding to source references winget
2023-03-06 21:40:35.613 [REPO] Multiple sources available, creating aggregated source.
2023-03-06 21:40:35.613 [REPO] Adding to aggregated source: msstore
2023-03-06 21:40:35.613 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/information
2023-03-06 21:40:35.778 [REPO] Response status: 200
2023-03-06 21:40:35.778 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/information
2023-03-06 21:40:35.796 [REPO] Response status: 200
2023-03-06 21:40:35.796 [REPO] Adding to aggregated source: winget
2023-03-06 21:40:35.818 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2023-03-06 21:40:35.818 [CORE] Found matching extension.
2023-03-06 21:40:35.867 [REPO] Opening SQLite Index for ImmutableRead at 'C:\Program Files\WindowsApps\Microsoft.Winget.Source_2023.306.2119.887_neutral__8wekyb3d8bbwe\Public\index.db'
2023-03-06 21:40:35.867 [SQL ] Opening SQLite connection #1: 'C:\Program Files\WindowsApps\Microsoft.Winget.Source_2023.306.2119.887_neutral__8wekyb3d8bbwe\Public\index.db' [1, 40]
2023-03-06 21:40:35.869 [REPO] Opened SQLite Index with version [1.6], last write [2023-03-06 21:18:39.000]
2023-03-06 21:40:35.981 [REPO] Creating PredefinedInstalledSource with filter [Machine]
2023-03-06 21:40:35.981 [REPO] Creating new SQLite Index [4294967295.4294967295] at ':memory:'
2023-03-06 21:40:35.981 [SQL ] Opening SQLite connection #2: ':memory:' [6, 0]
2023-03-06 21:40:36.075 [REPO] Reading MSI UpgradeCodes
2023-03-06 21:40:36.078 [REPO] Examining ARP entries for Machine | X64
2023-03-06 21:40:36.136 [REPO] Examining ARP entries for Machine | X86
2023-03-06 21:40:36.205 [FAIL] WindowsPackageManager.dll!00007FF8F3882571: LogHr(1) tid(2c68) 80070005 Access is denied.

2023-03-06 21:40:36.364 [CLI ] Caught winrt::hresult_error: 0x80070005 : unknown error

apcsb avatar Mar 06 '23 20:03 apcsb