{"record":{"id":"7eecc00575c80496","repo":"astrid-runtime/astrid","slug":"var-must-be-key-value-got-item-7eecc0","errorCode":null,"errorMessage":"--var must be KEY=VALUE (got {item:?})","messagePattern":"--var must be KEY=VALUE \\(got (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/install_daemon.rs","lineNumber":415,"sourceCode":"        return astrid_capsule::discovery::load_manifest(&path.join(\"Capsule.toml\"))\n            .map_err(Into::into);\n    }\n    if path.is_file() {\n        return astrid_capsule_install::read_archive_manifest(path)\n            .with_context(|| format!(\"read Capsule.toml from {}\", path.display()));\n    }\n    bail!(\"source path does not exist: {source}\")\n}\n\nfn validate_values(\n    manifest: &CapsuleManifest,\n    items: &[String],\n) -> anyhow::Result<Vec<DaemonEnvValue>> {\n    let mut parsed = HashMap::new();\n    for item in items {\n        let (key, value) = item\n            .split_once('=')\n            .ok_or_else(|| anyhow::anyhow!(\"--var must be KEY=VALUE (got {item:?})\"))?;\n        if key.is_empty() || key.contains('\\0') || key.contains(':') {\n            bail!(\"--var has an invalid key (got {key:?})\");\n        }\n        if parsed.insert(key.to_owned(), value.to_owned()).is_some() {\n            bail!(\"--var '{key}' was supplied more than once\");\n        }\n    }\n\n    let mut values = Vec::with_capacity(parsed.len());\n    for (key, value) in parsed {\n        let definition = manifest.env.get(&key).ok_or_else(|| {\n            anyhow::anyhow!(\n                \"--var names no [env] field in {}: {key}\",\n                manifest.package.name\n            )\n        })?;\n        let kind = if definition.env_type.eq_ignore_ascii_case(\"secret\") {\n            if value.len() > 64 * 1024 {","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/install_daemon.rs#L397-L433","documentation":"`validate_values` parses each `--var` CLI item by splitting on the first `=` to produce a KEY=VALUE pair for daemon env injection. It throws when an item contains no `=` at all, so no key/value pair can be extracted.","triggerScenarios":"Passing `--var KEY` (missing `=VALUE`), `--var \"KEY=\"`-less forms like `--var \"FLAG\"`, or values that got shell-mangled so the `=` was lost (e.g. unquoted spaces splitting the argument).","commonSituations":"Forgetting the value in shell history/editing; quoting mistakes where `--var KEY=VALUE` becomes two argv entries; copy-pasting env var names without values; writing `--var KEY:VALUE` (colon instead of equals).","solutions":["Supply the full KEY=VALUE form: `--var KEY=value`","Quote the argument in your shell so `=` and spaces survive: `--var \"KEY=some value\"`","Remember a separate `--var` flag per pair, not space-separated pairs"],"exampleFix":"// before\nmytool --var LOG_LEVEL\n// after\nmytool --var LOG_LEVEL=debug","handlingStrategy":"validation","validationCode":"fn valid_var_items(items: &[String]) -> bool {\n    items.iter().all(|i| {\n        match i.split_once('=') {\n            Some((k, _)) => !k.is_empty() && !k.contains('\\0') && !k.contains(':'),\n            None => false,\n        }\n    })\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().starts_with(\"--var must be KEY=VALUE\") => {\n        eprintln!(\"Fix the --var argument: each must be KEY=VALUE, quoted if it contains spaces.\");\n    }\n    other => other?,\n}","preventionTips":["Always quote --var values in shell: --var \"KEY=some value\"","Use a separate --var flag per pair","Lint CI scripts for bare --var keys without '='"],"tags":["cli","arguments","env","parsing"],"backgroundTag":"invalid-argument-format","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"}