{"record":{"id":"cc1d8d12e4a3818e","repo":"astrid-runtime/astrid","slug":"invalid-value-for-capsule-id-key-expected-one","errorCode":null,"errorMessage":"invalid value for {capsule_id}.{key}: expected one of {}, got {resolved:?}","messagePattern":"invalid value for (.+?)\\.(.+?): expected one of (.+?), got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/install_headless.rs","lineNumber":55,"sourceCode":"        let env_key = headless_env_key(&key);\n        let supplied = vars\n            .get(&key)\n            .cloned()\n            .or_else(|| std::env::var(&env_key).ok());\n        if supplied.is_none() && existing_keys.contains(&key) {\n            continue;\n        }\n        let resolved = supplied\n            .or_else(|| def.default.as_ref().map(json_value_string))\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"required value is missing for {capsule_id}.{key} \\\n                     (use --var {key}=… or set {env_key})\"\n                )\n            })?;\n\n        if !def.enum_values.is_empty() && !def.enum_values.iter().any(|item| item == &resolved) {\n            anyhow::bail!(\n                \"invalid value for {capsule_id}.{key}: expected one of {}, got {resolved:?}\",\n                def.enum_values.join(\", \")\n            );\n        }\n\n        if def.env_type == \"secret\" {\n            if resolved.is_empty() {\n                delete_env_entry(principal, capsule_id, &key, EnvValueKind::Secret)?;\n            } else {\n                set_env_entry(\n                    principal,\n                    capsule_id,\n                    &key,\n                    &resolved,\n                    EnvValueKind::Secret,\n                    EnvStorageScope::Agent,\n                )?;\n            }","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/install_headless.rs#L37-L73","documentation":"write_headless_env_fields resolves each env value (from --var or the environment variable) and, if the manifest declares enum_values for the field, enforces that the resolved value is one of them. A value outside the declared enum is rejected before it is written to the capsule.","triggerScenarios":"finish_install -> write_headless_env_fields resolves key K to a value (from --var K=… or env var) that is not present in def.enum_values for a field that declares an enum.","commonSituations":"Passing a value with wrong case or whitespace; supplying a deprecated enum option after a capsule upgrade; guessing a value like \"yes\" when the enum expects \"true\"; env variable holding a stale value overriding intent.","solutions":["Set the value to one of the listed allowed values shown in the error message.","Check case-sensitivity and surrounding whitespace in the --var value or environment variable.","Read the capsule manifest's [env] section for the current set of enum_values (it may have changed across versions).","Unset any environment variable that may be supplying a stale value."],"exampleFix":"// before\nastrid capsule install github:org/repo --var log-level=verbose   # enum: debug, info, warn, error\n// after\nastrid capsule install github:org/repo --var log-level=info","handlingStrategy":"validation","validationCode":"// check the value against the declared enum before install\nlet def = &manifest.env[\"log-level\"];\nif !def.enum_values.is_empty() && !def.enum_values.contains(&value) {\n    panic!(\"{} not in {:?}\", value, def.enum_values);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy allowed values verbatim from the capsule docs/manifest, including case.","Trim whitespace and mind quoting in shell when passing --var values.","Unset environment variables that may inject stale values for the same field."],"tags":["capsule","install","enum","validation"],"backgroundTag":"invalid-enum-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"}