{"record":{"id":"b97f30cd5e79b33e","repo":"astrid-runtime/astrid","slug":"rustc-could-not-report-cfg-values-for-cargo-target","errorCode":null,"errorMessage":"rustc could not report cfg values for Cargo target `{target}` (status {})","messagePattern":"rustc could not report cfg values for Cargo target `(.+?)` \\(status (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/rust/config.rs","lineNumber":360,"sourceCode":"    let platform = Platform::from_str(platform)\n        .with_context(|| format!(\"Invalid Cargo target platform `{platform}`\"))?;\n    if !matches!(platform, Platform::Cfg(_)) {\n        return Ok(platform.matches(selected_target, &[]));\n    }\n\n    if target_cfgs.is_none() {\n        *target_cfgs = Some(target_cfgs_for(selected_target)?);\n    }\n    Ok(platform.matches(selected_target, target_cfgs.as_deref().unwrap_or_default()))\n}\n\nfn target_cfgs_for(target: &str) -> Result<Vec<Cfg>> {\n    let output = Command::new(\"rustc\")\n        .args([\"--print\", \"cfg\", \"--target\", target])\n        .output()\n        .with_context(|| format!(\"Failed to inspect Cargo target cfg for `{target}`\"))?;\n    if !output.status.success() {\n        bail!(\n            \"rustc could not report cfg values for Cargo target `{target}` (status {})\",\n            output.status\n        );\n    }\n    std::str::from_utf8(&output.stdout)\n        .with_context(|| format!(\"rustc emitted invalid cfg output for `{target}`\"))?\n        .lines()\n        .map(|line| {\n            Cfg::from_str(line)\n                .with_context(|| format!(\"rustc emitted invalid cfg `{line}` for `{target}`\"))\n        })\n        .collect()\n}\n\nfn push_config_path(paths: &mut Vec<PathBuf>, cargo_dir: &Path) {\n    let toml = cargo_dir.join(\"config.toml\");\n    let legacy = cargo_dir.join(\"config\");\n    // Cargo prefers the extensionless file when both names exist.","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/rust/config.rs#L342-L378","documentation":"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.","triggerScenarios":"Thrown at crates/astrid-build/src/rust/config.rs:360 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install the rustup target component for `<target>`","Verify rustc is on PATH and functioning (`rustc --version`)","Check the target triple is valid"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}