{"record":{"id":"5e3ddda032d9f53d","repo":"unicity-aos/aos-ce","slug":"package-version-is-missing","errorCode":null,"errorMessage":"[package].version is missing.","messagePattern":"\\[package\\]\\.version is missing\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"capsules/capsule-forge/src/checks.rs","lineNumber":154,"sourceCode":"    }\n}\n\nfn check_package(root: &Toml, out: &mut Vec<Finding>) {\n    let pkg = root.get(\"package\");\n    let name = pkg.and_then(|p| p.get(\"name\")).and_then(Toml::as_str);\n    if name.is_none_or(str::is_empty) {\n        out.push(Finding::err(\n            \"[package].name is missing or empty.\",\n            \"Add `name = \\\"my-capsule\\\"` under [package].\",\n        ));\n    }\n    match pkg.and_then(|p| p.get(\"version\")).and_then(Toml::as_str) {\n        Some(v) if is_semverish(v) => {}\n        Some(v) => out.push(Finding::err(\n            format!(\"[package].version = \\\"{v}\\\" is not MAJOR.MINOR.PATCH.\"),\n            \"Use a three-part numeric version like \\\"0.1.0\\\".\",\n        )),\n        None => out.push(Finding::err(\n            \"[package].version is missing.\",\n            \"Add `version = \\\"0.1.0\\\"` under [package].\",\n        )),\n    }\n}\n\nfn check_component(root: &Toml, out: &mut Vec<Finding>) {\n    let comps = root.get(\"component\").and_then(Toml::as_array);\n    let has_file = comps.is_some_and(|arr| {\n        arr.iter().any(|c| {\n            c.get(\"file\")\n                .and_then(Toml::as_str)\n                .is_some_and(|f| !f.is_empty())\n        })\n    });\n    if !has_file {\n        out.push(Finding::err(\n            \"No [[component]] with a `file` was found.\",","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/unicity-aos/aos-ce/blob/f6f22024fb1e8d122f28a1b4a9f75aee448ae839/capsules/capsule-forge/src/checks.rs#L136-L172","documentation":"In the `check_package` version match, the `None` arm handles a missing `[package].version` key (or a non-string version, since `as_str()` yields None). The linter emits this distinct error from the malformed-version case so the developer knows exactly what to add. A version is mandatory for every capsule.","triggerScenarios":"Capsule.toml has [package] but no `version` key, or `version` is set to a non-string TOML type (integer/float) so `as_str()` returns None.","commonSituations":"Hand-writing a fresh manifest without versioning, deleting the version during a rename, or writing `version = 1` instead of a quoted string.","solutions":["Add `version = \"0.1.0\"` under [package].","If version exists as a number, quote it: `version = \"1.0.0\"`.","Adopt a semver string you can keep bumping per release."],"exampleFix":"// before\n[package]\nname = \"my-capsule\"\n\n// after\n[package]\nname = \"my-capsule\"\nversion = \"0.1.0\"","handlingStrategy":"validation","validationCode":"// Rust\nif root.get(\"package\").and_then(|p| p.get(\"version\")).and_then(|v| v.as_str()).is_none() {\n    return Err(\"[package].version is missing\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include version = \"0.1.0\" in every new manifest from the start.","Quote the version string; never write it as a bare number.","Add the lint to CI so missing keys fail the build."],"tags":["toml","versioning","schema-validation","config"],"backgroundTag":"missing-required-config-field","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"}