jdx/mise · error
winget list failed for '{}': {}
Error message
winget list failed for '{}': {} What it means
query_state runs `winget list` to determine a package's installed state. When winget exits with an unrecognized/unexpected code, the command's captured stdout/stderr detail is included in this error so the caller can see why winget failed. Query failures are deliberately propagated rather than treated as 'package missing'.
Source
Thrown at src/system/packages/winget.rs:147
match code {
Some(0) => {
let installed = parse_list_rows(stdout, &request.name);
if installed.is_empty() {
return Err(eyre::eyre!(
"winget list succeeded but returned no parseable row for '{}'",
request.name
));
}
Ok(package_state(request, &installed))
}
Some(NO_APPLICATIONS_FOUND) => Ok(PackageState::Missing),
_ => {
let detail = [stdout.trim(), stderr.trim()]
.into_iter()
.filter(|part| !part.is_empty())
.collect::<Vec<_>>()
.join("\n");
bail!("winget list failed for '{}': {}", request.name, detail);
}
}
}
/// Queries one package without accepting agreements or changing WinGet state.
async fn query_package(request: &PackageRequest) -> Result<PackageStatus> {
let args = list_args(request);
debug!("$ winget {}", args.join(" "));
let output = tokio::process::Command::new("winget")
.args(args)
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()
.await?;
let stdout = String::from_utf8_lossy(&output.stdout);
let stderr = String::from_utf8_lossy(&output.stderr);
let state = query_state(output.status.code(), &stdout, &stderr, request)?;View on GitHub (pinned to afd2eddd3a)
Solutions
- Read the detail appended to the error; run the same `winget list` command manually to reproduce
- Run `winget source update` (and `winget source reset --force` if sources are broken)
- Accept agreements by running `winget list` once interactively and handling prompts
- Update the App Installer package (winget) from the Microsoft Store or via `winget upgrade Microsoft.DesktopAppInstaller`
Example fix
// before mise packages status winget:Git.Git # winget list failed for 'Git.Git': No package found matching input criteria. // after (fix source then retry) winget source update mise packages status winget:Git.Git
Defensive patterns
Strategy: retry
Validate before calling
if !command_exists("winget") { return Err(anyhow!("winget unavailable")); }
let probe = Command::new("winget").arg("source").arg("list").output()?;
if !probe.status.success() { run("winget source update")?; } Type guard
fn winget_healthy(status: Option<i32>) -> bool { status == Some(0) } Try / catch
match query_package(&req).await {
Err(e) if e.to_string().contains("winget list failed") => {
winget_source_update().await?; query_package(&req).await
}
other => other,
} Prevention
- Run `winget source update` periodically and after first boot in CI images
- Update App Installer/winget regularly
- Accept source agreements once interactively before automated runs
When it happens
Trigger: Calling query_package (via query_state) when `winget list --id <pkg>` exits with a non-success, non-accepted code — e.g. winget source unavailable, msstore agreement issues, corrupted winget install, or package id causing a winget error.
Common situations: CI container where the winget source (msstore/winget) has never been updated or agreements not accepted; App Installer/winget out of date; restricted Windows environment where winget is disabled; transient source-network failures.
Related errors
- winget {action} failed with {status}
- winget source agreement preparation failed with {output}
- apk info failed: {}
- apt-cache policy failed: {}
- mas list failed: {}
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/1ebf40197269f738.
Report an issue: GitHub.