{"record":{"id":"5227edb7a88b2fc9","repo":"unicity-aos/aos-ce","slug":"capsule-toml-is-not-valid-toml-e","errorCode":null,"errorMessage":"Capsule.toml is not valid TOML: {e}","messagePattern":"Capsule\\.toml is not valid TOML: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"capsules/capsule-forge/src/checks.rs","lineNumber":63,"sourceCode":"    let parts: Vec<&str> = v.split('.').collect();\n    parts.len() == 3\n        && parts\n            .iter()\n            .all(|p| !p.is_empty() && p.bytes().all(|b| b.is_ascii_digit()))\n}\n\n/// A topic segment is malformed if the key has empty segments\n/// (leading/trailing/consecutive dots).\nfn has_empty_segments(topic: &str) -> bool {\n    topic.is_empty() || topic.starts_with('.') || topic.ends_with('.') || topic.contains(\"..\")\n}\n\n/// Run all manifest lints. Returns the findings in roughly severity order.\npub(crate) fn validate_manifest(toml_src: &str) -> Vec<Finding> {\n    let root: Toml = match toml_src.parse() {\n        Ok(t) => t,\n        Err(e) => {\n            return vec![Finding::err(\n                format!(\"Capsule.toml is not valid TOML: {e}\"),\n                \"Fix the syntax error reported above; the rest of the lint can't run until it parses.\",\n            )];\n        }\n    };\n\n    let mut out = Vec::new();\n    check_package(&root, &mut out);\n    check_component(&root, &mut out);\n    check_capabilities(&root, &mut out);\n    check_env(&root, &mut out);\n    let (pub_keys, sub_keys) = collect_topics(&root, &mut out);\n    check_tool_bus(&sub_keys, &pub_keys, &root, &mut out);\n    check_topic_shapes(&pub_keys, &sub_keys, &mut out);\n    out\n}\n\nfn check_capabilities(root: &Toml, out: &mut Vec<Finding>) {","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/unicity-aos/aos-ce/blob/f6f22024fb1e8d122f28a1b4a9f75aee448ae839/capsules/capsule-forge/src/checks.rs#L45-L81","documentation":"`validate_manifest` first tries to parse Capsule.toml into a TOML document; if parsing fails it stops immediately and returns a single Finding carrying the toml crate's error text. No other lints can run because there is no parse tree to inspect. This is a parse-time failure, not a semantic lint failure.","triggerScenarios":"Calling `validate_manifest(toml_src)` with a string containing TOML syntax errors: unbalanced brackets, invalid key names, unterminated strings, wrong indentation in inline tables, or duplicate keys.","commonSituations":"Hand-editing Capsule.toml and dropping a bracket or quote, pasting YAML-style config, saving the wrong file, or an editor mangling UTF-8/special characters.","solutions":["Read the toml error message appended to the Finding: it gives the line/column of the syntax error; fix that line.","Validate the file with a TOML parser/linter (e.g. `taplo lint Capsule.toml`) before running the forge again.","If generated programmatically, serialize with a TOML library instead of string concatenation."],"exampleFix":"# before\ncapabilities = [uplink]\n\n# after\ncapabilities = { uplink = [] }\n# or use a [capabilities] table","handlingStrategy":"validation","validationCode":"// Rust: pre-validate TOML before the linter\ntoml::from_str::<toml::Value>(&src).map_err(|e| format!(\"invalid TOML: {e}\"))?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run a TOML linter (taplo) in CI on all Capsule.toml files.","Generate TOML with a serializer library rather than string templates.","Enable editor TOML syntax highlighting/format-on-save."],"tags":["toml","syntax-error","config","lint"],"backgroundTag":"toml-parse-error","analyzedSha":"f6f22024fb1e8d122f28a1b4a9f75aee448ae839","analyzedAt":"2026-09-13T03:04:44.565Z","contentChangedAt":"2026-09-13T03:04:44.565Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}