slint-ui/slint · error
cargo failed
Error message
cargo {} failed What it means
`run_cargo` in xtask executes a cargo subprocess and bails when it exits non-zero. The message includes the full argument list, so it reports which cargo invocation failed — it is a wrapper error around any cargo failure (build errors, bad args, toolchain problems).
Solutions
- Run the reported cargo command manually to see the underlying error output
- Fix the underlying cargo failure (Cargo.toml syntax, network, toolchain) indicated by the cargo output
- Ensure the CARGO environment variable points to a working cargo when overriding the default
Defensive patterns
Strategy: retry
Validate before calling
cargo --version && cargo metadata --format-version 1 > /dev/null
Prevention
- Verify cargo works and the registry is reachable before running xtask
- Inspect the args echoed in the error to reproduce the failing command manually
- Keep Cargo.toml/Cargo.lock syntactically valid and committed
When it happens
Trigger: Any `cargo` command invoked by xtask (e.g. during license generation or metadata resolution) exiting with a non-zero status: syntax errors in Cargo.toml, unavailable network for registry access, wrong toolchain, or invalid arguments.
Common situations: CI runners without network access to crates.io; corrupted Cargo.lock; running xtask in an environment where `CARGO` env var points to a broken binary.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- failed: exited with
- dev-dependencies cannot be from the workspace because…
- Incorrect . Found expected
- Incorrect .workspace found: expected true, found false
- Invalid Cargo.toml -- cannot find package section
AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16).
Data as JSON: /api/errors/84ea889d90a1603c.
Report an issue: GitHub.
Appendix: source
Thrown at xtask/src/license.rs:278
name: String,
text: String,
}
/// Run `cargo fetch` (for all targets) so that `cargo metadata` can resolve the
/// full dependency graph offline.
fn fetch_dependencies(manifest_path: &Path) -> anyhow::Result<()> {
let manifest = manifest_path.to_str().context("Non-UTF-8 manifest path")?;
run_cargo(&["fetch", "--manifest-path", manifest])?;
Ok(())
}
fn run_cargo(args: &[&str]) -> anyhow::Result<()> {
let status = std::process::Command::new(std::env::var("CARGO").as_deref().unwrap_or("cargo"))
.args(args)
.status()
.with_context(|| format!("Failed to run cargo {}", args.join(" ")))?;
if !status.success() {
bail!("cargo {} failed", args.join(" "));
}
Ok(())
}
/// Resolve the runtime dependency packages across all target platforms,
/// restricted to the features enabled in the analyzed crate and honoring
/// `IGNORE_DEV_DEPENDENCIES`.
///
/// `cargo metadata` is run without `--filter-platform`, so its resolve graph
/// spans every target. Its graph keeps optional dependencies even when no
/// active feature enables them, so the walk follows only the edges that the
/// resolved feature set of each crate actually activates.
///
/// Only crates linked into the program are listed: the walk never crosses a
/// `[build-dependencies]` edge or enters a proc-macro crate, since those are
/// used only while building and are not distributed.
fn resolve_packages(
manifest_path: &Path,View on GitHub (pinned to bb937076de)