astrid-runtime/astrid · error
Cargo build.target must be a string or array in
Error message
Cargo build.target must be a string or array in {} What it means
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.
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/astrid-build/src/rust/config.rs:183 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/e55338d01cd2dabe.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-build/src/rust/config.rs:183
for include in cargo_config_includes(&doc, path)?.into_iter().flatten() {
self.load(&include, state)?;
}
state.absorb_document(&doc, path)
}
}
impl CargoConfigState {
fn absorb_document(&mut self, doc: &toml_edit::DocumentMut, path: &Path) -> Result<()> {
if let Some(item) = doc.get("build").and_then(|build| build.get("target")) {
if let Some(value) = item.as_str() {
self.target = Some(value.to_owned());
} else if item.as_array().is_some() {
// Cargo supports a target array for multi-target builds. This
// packager has one executable slot, so it must not guess.
self.target = None;
} else {
bail!(
"Cargo build.target must be a string or array in {}",
path.display()
);
}
}
if let Some(item) = doc.get("build").and_then(|build| build.get("rustflags")) {
merge_rustflags(&mut self.build_flags, parse_rustflags(item, path)?);
}
if let Some(targets) = doc.get("target").and_then(toml_edit::Item::as_table_like) {
for (platform, item) in targets.iter() {
let Some(rustflags) = item
.as_table_like()
.and_then(|target| target.get("rustflags"))
else {
continue;
};
self.target_entriesView on GitHub (pinned to affd8760f4)