jdx/mise · error
winget failed with
Error message
winget {action} failed with {status} What it means
winget was invoked (install, uninstall, upgrade, or source-related action) for packages, and the process exited with a code not in the accepted list for that action, so the wrapper bails. This is a pass-through of winget's own failure status; the underlying cause (network, package not found, agreement needed) is in winget's stderr, which is streamed to the terminal.
Solutions
- Read the winget output above the error in the terminal (stderr is inherited) and address the specific winget failure code.
- Run `winget source update` and retry; stale source data is a common cause.
- Verify the exact package ID with `winget search <name>` and correct the package list.
- Rerun from an elevated shell if the package requires machine-wide installation.
- Retry later if winget reports a transient network/service error.
Example fix
// before (package id wrong) packages = ["microsof.vscode"] // after packages = ["Microsoft.VisualStudioCode"]
Defensive patterns
Strategy: try-catch
Validate before calling
// Windows: verify package id resolves before running
const id = pkg;
const search = spawnSync('winget', ['search', '--exact', id]);
if (search.status !== 0) throw new Error(`unknown winget package: ${id}`); Try / catch
try {
await runPackages(pkgs);
} catch (e) {
if (String(e).includes('winget')) {
console.error('winget failed; see stderr above. Try: winget source update, or fix the package id.');
}
throw e;
} Prevention
- Validate package IDs with `winget search --exact` before batch installs.
- Run elevated shells for machine-wide packages.
- Keep winget/App Installer updated and run `winget source update` periodically.
- Capture winget stderr — it contains the authoritative failure code.
When it happens
Trigger: run_winget spawns `winget <action> ...` with inherited stdout/stderr; after awaiting status, command_succeeded(status.code(), accepted_exit_codes) returns false — e.g. winget exits 0x8A15002B (no package found), a nonzero installer exit code, or any exit code outside the accepted list passed by the caller.
Common situations: Installing/upgrading a Windows package whose ID is misspelled or no longer in the winget repository; winget lacking admin elevation for machine-wide installs; winget source out of date; the installer itself failing (corrupt download, blocked by policy/antivirus).
Related errors
- winget list failed for
- winget source agreement preparation failed with
- pacman -Q failed
- pacman -T failed
- apk info failed
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/a8ac52d7b507e7a4.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/packages/winget.rs:188
}
/// Returns whether an exit code is successful for the current operation.
fn command_succeeded(code: Option<i32>, accepted_exit_codes: &[i32]) -> bool {
code == Some(0) || code.is_some_and(|code| accepted_exit_codes.contains(&code))
}
/// Runs WinGet and accepts only zero plus explicitly allowed no-op codes.
async fn run_winget(args: &[String], action: &str, accepted_exit_codes: &[i32]) -> Result<()> {
debug!("$ winget {}", args.join(" "));
let status = tokio::process::Command::new("winget")
.args(args)
.stdin(Stdio::null())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.status()
.await?;
if !command_succeeded(status.code(), accepted_exit_codes) {
bail!("winget {action} failed with {status}");
}
Ok(())
}
/// Applies a WinGet command to each requested package in order.
async fn run_packages(
command: &str,
pkgs: &[PackageRequest],
dry_run: bool,
accepted_exit_codes: &[i32],
) -> Result<()> {
for pkg in pkgs {
let args = package_args(command, pkg);
if dry_run {
miseprintln!("winget {}", args.join(" "));
} else {
run_winget(
&args,View on GitHub (pinned to 533346cc37)