{"record":{"id":"a09915b9ec225c88","repo":"astrid-runtime/astrid","slug":"var-names-no-env-field-in-capsule-id-key-a09915","errorCode":null,"errorMessage":"--var names no [env] field in {capsule_id}: {key}","messagePattern":"--var names no \\[env\\] field in (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/install_prompts.rs","lineNumber":158,"sourceCode":"}\n\n/// Collect declared configuration before a daemon-owned install transaction.\n///\n/// The returned `KEY=VALUE` records are sent in the typed install request so\n/// the kernel can stage them before invoking the lifecycle hook and roll them\n/// back if installation fails. Existing daemon values are left untouched\n/// unless the operator supplied an explicit replacement.\npub(super) fn collect_install_env_fields(\n    env_defs: &HashMap<String, EnvDef>,\n    capsule_id: &str,\n    existing_keys: &std::collections::HashSet<String>,\n    supplied: &HashMap<String, String>,\n    headless: bool,\n    config_path: &Path,\n) -> anyhow::Result<Vec<String>> {\n    for key in supplied.keys() {\n        if !env_defs.contains_key(key) {\n            anyhow::bail!(\"--var names no [env] field in {capsule_id}: {key}\");\n        }\n    }\n\n    let mut collected = serde_json::Map::new();\n    for key in existing_keys {\n        collected.insert(key.clone(), serde_json::Value::String(String::new()));\n    }\n\n    let mut prompted = false;\n    let mut values = Vec::new();\n    for key in order_env_keys(env_defs) {\n        let def = &env_defs[&key];\n        let value = if let Some(value) = supplied.get(&key) {\n            value.clone()\n        } else if existing_keys.contains(&key) {\n            continue;\n        } else if headless {\n            let env_key = headless_env_key(&key);","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/install_prompts.rs#L140-L176","documentation":"collect_install_env_fields validates explicitly supplied --var values against the capsule manifest's declared [env] fields before collecting or prompting. Supplied keys not declared in the manifest are rejected immediately in both headless and interactive installs.","triggerScenarios":"collect_install_env_fields (invoked during capsule install flows, e.g. tests install_collection_* or real installs) receives a supplied key that is absent from env_defs.","commonSituations":"Typo in a --var key; stale automation scripts passing fields removed in a newer capsule release; mixing up field names between similar capsules.","solutions":["Correct the --var key to match a declared [env] field in the capsule manifest.","Drop the --var flag if the field no longer exists in this capsule version; interactive mode will prompt for what is needed.","Regenerate or review your install script/CI config against the current capsule version's manifest."],"exampleFix":"// before (CI step)\nastrid capsule install github:org/repo --var endpoint_url=https://...   # manifest declares endpoint\n// after\nastrid capsule install github:org/repo --var endpoint=https://...","handlingStrategy":"validation","validationCode":"// gate CI install steps on declared env fields\nlet declared: HashSet<&str> = manifest.env.keys().map(|k| k.as_str()).collect();\nfor key in supplied_vars.keys() {\n    assert!(declared.contains(key.as_str()), \"--var {key} not declared\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Diff your install flags against the manifest when bumping capsule versions.","Centralize --var definitions to avoid drift between environments.","Prefer letting interactive mode prompt rather than guessing field names in scripts."],"tags":["capsule","install","env","cli"],"backgroundTag":"invalid-argument-value","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}