{"record":{"id":"6b43cca992c4a4fd","repo":"astrid-runtime/astrid","slug":"invalid-value-for-expected-one-of-got","errorCode":null,"errorMessage":"invalid value for {}.{}: expected one of {}, got {value:?}","messagePattern":"invalid value for (.+?)\\.(.+?): expected one of (.+?), got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/install_daemon.rs","lineNumber":449,"sourceCode":"        })?;\n        let kind = if definition.env_type.eq_ignore_ascii_case(\"secret\") {\n            if value.len() > 64 * 1024 {\n                bail!(\"secret value for {key} exceeds 65536-byte limit\");\n            }\n            EnvValueKind::Secret\n        } else {\n            if value.len() > 1 << 20 {\n                bail!(\"environment value for {key} exceeds 1048576-byte limit\");\n            }\n            EnvValueKind::Text\n        };\n        if !definition.enum_values.is_empty()\n            && !definition\n                .enum_values\n                .iter()\n                .any(|allowed| allowed == &value)\n        {\n            bail!(\n                \"invalid value for {}.{}: expected one of {}, got {value:?}\",\n                manifest.package.name,\n                key,\n                definition.enum_values.join(\", \"),\n            );\n        }\n        values.push(DaemonEnvValue { key, value, kind });\n    }\n    values.sort_by(|left, right| left.key.cmp(&right.key));\n    Ok(values)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    fn identity(digest: &str, generation: InstalledCapsuleGeneration) -> InstalledCapsuleIdentity {\n        InstalledCapsuleIdentity {","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/install_daemon.rs#L431-L467","documentation":"If the [env] definition in Capsule.toml declares enum_values, validate_values requires the supplied value to be one of them. Otherwise it bails listing the manifest/package name, the allowed values, and the offending value.","triggerScenarios":"Passing --var KEY=value where definition.enum_values is non-empty and no entry equals the supplied value, during install_local_via_daemon_for_target_with_generation.","commonSituations":"Typo in a enum-constrained value (e.g. `--var LOG_LEVEL=infoo`); case mismatch; manifest enum tightened in a newer capsule version while scripts still pass old values.","solutions":["Use one of the allowed values listed in the error message exactly.","Check the [env.KEY] enum_values in Capsule.toml for the accepted set and casing.","Update scripts/configs after a manifest change that altered the enum.","If the value is legitimately new, extend enum_values in Capsule.toml."],"exampleFix":"// before\n--var LOG_LEVEL=verbose\n// after (enum_values = [\"debug\", \"info\", \"warn\", \"error\"])\n--var LOG_LEVEL=info","handlingStrategy":"validation","validationCode":"// parse enum_values from Capsule.toml [env.KEY] and check membership before install\nassert!(enum_values.contains(&value), \"invalid value for {key}\");","typeGuard":null,"tryCatchPattern":"on this error, print the allowed set from the message and abort the script so the operator corrects the value.","preventionTips":["Generate --var values from the manifest's enum_values, not free text.","Re-validate scripts after any Capsule.toml enum change.","Match enum casing exactly as declared."],"tags":["validation","enum","env","cli"],"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"}