astrid-runtime/astrid · error
rustc could not report cfg values for Cargo target
Error message
rustc could not report cfg values for Cargo target `{target}` (status {}) What it means
Fired by target_cfgs_for when `rustc --print cfg --target <target>` exits non-zero or produces unparseable output. Without rustc's cfg list, cfg()-gated platform matching for the target cannot be evaluated.
Solutions
- Install the rustup target component for `<target>`
- Verify rustc is on PATH and functioning (`rustc --version`)
- Check the target triple is valid
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/astrid-build/src/rust/config.rs:360 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/b97f30cd5e79b33e.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-build/src/rust/config.rs:360
let platform = Platform::from_str(platform)
.with_context(|| format!("Invalid Cargo target platform `{platform}`"))?;
if !matches!(platform, Platform::Cfg(_)) {
return Ok(platform.matches(selected_target, &[]));
}
if target_cfgs.is_none() {
*target_cfgs = Some(target_cfgs_for(selected_target)?);
}
Ok(platform.matches(selected_target, target_cfgs.as_deref().unwrap_or_default()))
}
fn target_cfgs_for(target: &str) -> Result<Vec<Cfg>> {
let output = Command::new("rustc")
.args(["--print", "cfg", "--target", target])
.output()
.with_context(|| format!("Failed to inspect Cargo target cfg for `{target}`"))?;
if !output.status.success() {
bail!(
"rustc could not report cfg values for Cargo target `{target}` (status {})",
output.status
);
}
std::str::from_utf8(&output.stdout)
.with_context(|| format!("rustc emitted invalid cfg output for `{target}`"))?
.lines()
.map(|line| {
Cfg::from_str(line)
.with_context(|| format!("rustc emitted invalid cfg `{line}` for `{target}`"))
})
.collect()
}
fn push_config_path(paths: &mut Vec<PathBuf>, cargo_dir: &Path) {
let toml = cargo_dir.join("config.toml");
let legacy = cargo_dir.join("config");
// Cargo prefers the extensionless file when both names exist.View on GitHub (pinned to affd8760f4)