{"record":{"id":"f62a44d72153a1f6","repo":"astrid-runtime/astrid","slug":"capsule-toml-has-no-package-name","errorCode":null,"errorMessage":"Capsule.toml has no package.name","messagePattern":"Capsule\\.toml has no package\\.name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/storage.rs","lineNumber":725,"sourceCode":"                continue;\n            }\n            fs::copy(path, destination)?;\n        } else {\n            bail!(\"legacy capsule contains special file {}\", path.display());\n        }\n    }\n    Ok(())\n}\n\nfn manifest_identity(source_dir: &Path) -> anyhow::Result<(String, String)> {\n    let manifest = fs::read_to_string(source_dir.join(\"Capsule.toml\"))\n        .with_context(|| format!(\"read capsule manifest from {}\", source_dir.display()))?;\n    let value: toml::Value = toml::from_str(&manifest).context(\"parse capsule manifest\")?;\n    let id = value\n        .get(\"package\")\n        .and_then(|package| package.get(\"name\"))\n        .and_then(toml::Value::as_str)\n        .ok_or_else(|| anyhow::anyhow!(\"Capsule.toml has no package.name\"))?;\n    let version = value\n        .get(\"package\")\n        .and_then(|package| package.get(\"version\"))\n        .and_then(toml::Value::as_str)\n        .ok_or_else(|| anyhow::anyhow!(\"Capsule.toml has no package.version\"))?;\n    Ok((id.to_owned(), version.to_owned()))\n}\n\nfn authority_capsule_id(authority: &[u8]) -> anyhow::Result<String> {\n    let authority: InstalledAuthority =\n        serde_json::from_slice(authority).context(\"decode authority receipt for package id\")?;\n    if authority.capsule_id.is_empty() {\n        bail!(\"authority receipt has an empty capsule id\");\n    }\n    Ok(authority.capsule_id)\n}\n\n/// Build a deterministic gzip/tar package from a checked directory.","sourceCodeStart":707,"sourceCodeEnd":743,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/storage.rs#L707-L743","documentation":"manifest_identity parses the Capsule.toml manifest from a source directory and extracts the package id from package.name. If the manifest lacks the [package] table or its name string key, the library throws because the capsule cannot be identified for publishing.","triggerScenarios":"publish_directory_package reads Capsule.toml in source_dir, TOML parsing succeeds, but value.get(\"package\").get(\"name\").as_str() is None — no [package] section, no name key, or name is not a string.","commonSituations":"Hand-written or truncated Capsule.toml missing the package table; typos like [pacakge] or name = 123 (non-string); manifest generated by an older tooling version with a different schema.","solutions":["Add a [package] section with a string name field to Capsule.toml and republish.","Validate Capsule.toml parses as expected (e.g. toml-lint) and confirm the key is exactly `name` under `[package]`.","Regenerate the manifest with the current capsule tooling if it was produced by an older format."],"exampleFix":"// before: Capsule.toml without package name\n// after:\n// [package]\n// name = \"my-capsule\"\n// version = \"0.1.0\"","handlingStrategy":"validation","validationCode":"fn manifest_has_name(capsule_dir: &Path) -> anyhow::Result<()> {\n    let raw = std::fs::read_to_string(capsule_dir.join(\"Capsule.toml\"))?;\n    let v: toml::Value = toml::from_str(&raw)?;\n    if v.get(\"package\").and_then(|p| p.get(\"name\")).and_then(|n| n.as_str()).is_some() {\n        Ok(())\n    } else {\n        Err(anyhow::anyhow!(\"Capsule.toml missing [package].name string\"))\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always keep [package] name as a quoted string in Capsule.toml","Lint Capsule.toml in CI before publishing","Use the project scaffolding tool to generate manifests instead of hand-editing"],"tags":["config","toml","manifest"],"backgroundTag":"missing-required-config-field","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}