{"record":{"id":"e55338d01cd2dabe","repo":"astrid-runtime/astrid","slug":"cargo-build-target-must-be-a-string-or-array-in","errorCode":null,"errorMessage":"Cargo build.target must be a string or array in {}","messagePattern":"Cargo build\\.target must be a string or array in (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/rust/config.rs","lineNumber":183,"sourceCode":"\n        for include in cargo_config_includes(&doc, path)?.into_iter().flatten() {\n            self.load(&include, state)?;\n        }\n        state.absorb_document(&doc, path)\n    }\n}\n\nimpl CargoConfigState {\n    fn absorb_document(&mut self, doc: &toml_edit::DocumentMut, path: &Path) -> Result<()> {\n        if let Some(item) = doc.get(\"build\").and_then(|build| build.get(\"target\")) {\n            if let Some(value) = item.as_str() {\n                self.target = Some(value.to_owned());\n            } else if item.as_array().is_some() {\n                // Cargo supports a target array for multi-target builds. This\n                // packager has one executable slot, so it must not guess.\n                self.target = None;\n            } else {\n                bail!(\n                    \"Cargo build.target must be a string or array in {}\",\n                    path.display()\n                );\n            }\n        }\n\n        if let Some(item) = doc.get(\"build\").and_then(|build| build.get(\"rustflags\")) {\n            merge_rustflags(&mut self.build_flags, parse_rustflags(item, path)?);\n        }\n        if let Some(targets) = doc.get(\"target\").and_then(toml_edit::Item::as_table_like) {\n            for (platform, item) in targets.iter() {\n                let Some(rustflags) = item\n                    .as_table_like()\n                    .and_then(|target| target.get(\"rustflags\"))\n                else {\n                    continue;\n                };\n                self.target_entries","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/rust/config.rs#L165-L201","documentation":"Fired by CargoConfigState::absorb_document when `build.target` in a Cargo config file is neither a string nor an array (e.g. an inline table or boolean). Only those two forms match Cargo's accepted syntax.","triggerScenarios":"Thrown at crates/astrid-build/src/rust/config.rs:183 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set `build.target = \"wasm32-unknown-unknown\"` (string form)","Or use an array of target triples","Fix the TOML type in the offending config file"],"exampleFix":null,"handlingStrategy":"validation","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"}