{"record":{"id":"2ed985e0e572c07e","repo":"astrid-runtime/astrid","slug":"capsule-toml-component-must-be-an-array-of-tables","errorCode":null,"errorMessage":"Capsule.toml component must be an array of tables","messagePattern":"Capsule\\.toml component must be an array of tables","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/rust.rs","lineNumber":733,"sourceCode":"    toml_doc: &mut toml_edit::DocumentMut,\n    packaged_name: &str,\n) -> Result<()> {\n    validate_wasm_output_name(packaged_name.strip_suffix(\".wasm\").unwrap_or(packaged_name))?;\n\n    let Some(component_item) = toml_doc.get_mut(\"component\") else {\n        let mut component = toml_edit::Table::new();\n        let component_id = packaged_name.strip_suffix(\".wasm\").unwrap_or(packaged_name);\n        component.insert(\"id\", toml_edit::value(component_id));\n        component.insert(\"file\", toml_edit::value(packaged_name));\n        component.insert(\"type\", toml_edit::value(\"executable\"));\n        let mut components = toml_edit::ArrayOfTables::new();\n        components.push(component);\n        toml_doc.insert(\"component\", toml_edit::Item::ArrayOfTables(components));\n        return Ok(());\n    };\n\n    let Some(components) = component_item.as_array_of_tables_mut() else {\n        bail!(\"Capsule.toml component must be an array of tables\")\n    };\n    if components.len() != 1 {\n        bail!(\n            \"Capsule.toml declares {} components, but this build packages exactly one cdylib\",\n            components.len()\n        );\n    }\n    let component = components\n        .get_mut(0)\n        .context(\"Capsule.toml component array unexpectedly empty\")?;\n    let has_file = component.get(\"file\").is_some();\n    let has_entrypoint = component.get(\"entrypoint\").is_some();\n    if has_file && has_entrypoint {\n        bail!(\n            \"Capsule.toml component declares both `file` and `entrypoint`; refusing an ambiguous executable path\"\n        );\n    }\n","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/rust.rs#L715-L751","documentation":"Fired by bind_manifest_to_packaged_wasm when the `component` key in Capsule.toml is present but is not an array of tables (e.g. a plain table or string). The manifest format only supports an array of component tables.","triggerScenarios":"Thrown at crates/astrid-build/src/rust.rs:733 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rewrite `component` as an array of tables: `[[component]]` blocks","Remove the malformed component key so the build regenerates it","Validate Capsule.toml TOML syntax"],"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"}