Devolutions/UniGetUI · error · UnauthorizedAccessException
This package cannot be installed from an elevated context.Pl
Error message
This package cannot be installed from an elevated context.Please run UniGetUI as a regular user and try again.
What it means
WinGet ApplyElevationRequirements throws UnauthorizedAccessException when a package's InstallationOptions declares ElevationProhibited AND UniGetUI is currently running elevated (CoreTools.IsAdministrator() is true). The package refuses to install under an admin token; the message tells the user to relaunch as a regular user.
Source
Thrown at src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgOperationHelper.cs:207
operation
);
if (
installOptions?.ElevationRequirement
is ElevationRequirement.ElevationRequired
or ElevationRequirement.ElevatesSelf
)
{
Logger.Info(
$"WinGet package {package.Id} requires elevation, forcing administrator rights..."
);
package.OverridenOptions.RunAsAdministrator = true;
}
else if (
installOptions?.ElevationRequirement is ElevationRequirement.ElevationProhibited
)
{
if (CoreTools.IsAdministrator())
throw new UnauthorizedAccessException(
CoreTools.Translate(
"This package cannot be installed from an elevated context."
)
+ CoreTools.Translate(
"Please run UniGetUI as a regular user and try again."
)
);
if (options.RunAsAdministrator)
throw new UnauthorizedAccessException(
CoreTools.Translate(
"This package cannot be installed from an elevated context."
)
+ CoreTools.Translate(
"Please check the installation options for this package and try again"
)
);
View on GitHub (pinned to 9b1d7d0eab)
Solutions
- Relaunch UniGetUI as a regular (non-elevated) user and retry the install.
- Do not launch UniGetUI via 'Run as administrator'.
- In an automated/elevated context, skip packages whose ElevationRequirement is ElevationProhibited.
Example fix
// before: launched as admin -> throw
// after (caller guard): skip prohibited packages when elevated
if (CoreTools.IsAdministrator() &&
pkgInstallOptions?.ElevationRequirement is ElevationRequirement.ElevationProhibited)
continue; // skip; cannot install elevated Defensive patterns
Strategy: validation
Validate before calling
// Caller guard: skip prohibited packages when elevated.
var inst = NativePackageHandler.GetInstallationOptions(pkg, options, op);
if (CoreTools.IsAdministrator() &&
inst?.ElevationRequirement is ElevationRequirement.ElevationProhibited)
return OperationVeredict.Skipped; Type guard
static bool ProhibitsElevation(InstallationOptions? o) =>
o?.ElevationRequirement is ElevationRequirement.ElevationProhibited; Prevention
- Do not launch UniGetUI as administrator for per-user/Store packages.
- Filter ElevationProhibited packages out of batch operations when elevated.
- Surface a clear 'relaunch as regular user' message to the end user.
When it happens
Trigger: Installing/upgrading a WinGet package whose manifest marks ElevationRequirement as ElevationProhibited while UniGetUI was launched as administrator.
Common situations: User right-clicked 'Run as administrator'; package is a per-user app (e.g. MSIX) that the Store rejects under admin; elevation was inherited from a parent elevated process.
Related errors
- This package cannot be installed from an elevated context.Pl
- Scoop is not ready.
- The maintenance command exited with code {process.ExitCode}.
- The manager action "{action}" is only supported on Windows.
- Microsoft Store python alias is not a valid python install
AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13).
Data as JSON: /api/errors/6b1bfcb17ee81b40.
Report an issue: GitHub.