{"record":{"id":"4ff1c1a72b2d555e","repo":"astrid-runtime/astrid","slug":"capsule-toml-component-key-must-be-a-string","errorCode":null,"errorMessage":"Capsule.toml component `{key}` must be a string","messagePattern":"Capsule\\.toml component `(.+?)` must be a string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/rust.rs","lineNumber":762,"sourceCode":"    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\n    let key = if has_file {\n        \"file\"\n    } else if has_entrypoint {\n        \"entrypoint\"\n    } else {\n        \"file\"\n    };\n    if let Some(item) = component.get(key)\n        && item.as_str().is_none()\n    {\n        bail!(\"Capsule.toml component `{key}` must be a string\")\n    }\n    component.insert(key, toml_edit::value(packaged_name));\n    Ok(())\n}\n\n/// Resolve the output directory, creating it if necessary.\nfn resolve_output_dir(output: Option<&str>) -> Result<PathBuf> {\n    let out_dir = match output {\n        Some(p) => PathBuf::from(p),\n        None => std::env::current_dir()?.join(\"dist\"),\n    };\n    if !out_dir.exists() {\n        fs::create_dir_all(&out_dir)?;\n    }\n    Ok(out_dir)\n}\n\n/// Stage a `wit/` directory for inclusion in the capsule archive.","sourceCodeStart":744,"sourceCodeEnd":780,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/rust.rs#L744-L780","documentation":"Type validation in bind_manifest_to_packaged_wasm: after choosing `file` or `entrypoint` as the executable-path key, the corresponding TOML value exists but is not a string (e.g. a number, boolean, or table). The component's executable path must be a string so it can be rewritten to the packaged .wasm name; any other TOML type is rejected.","triggerScenarios":"Thrown at crates/astrid-build/src/rust.rs:762 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Quote the value: `file = \"name.wasm\"`","Fix the TOML type (numbers/booleans/arrays are not valid here)","Rebuild after correcting Capsule.toml"],"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"}