{"record":{"id":"7ae4f8c85f515022","repo":"astrid-runtime/astrid","slug":"environment-value-for-key-exceeds-1048576-byte-l","errorCode":null,"errorMessage":"environment value for {key} exceeds 1048576-byte limit","messagePattern":"environment value for (.+?) exceeds 1048576-byte limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/install_daemon.rs","lineNumber":439,"sourceCode":"        }\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 {\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    }","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/install_daemon.rs#L421-L457","documentation":"Fired by validate_values when a non-secret `--var` value passed to the capsule installer exceeds the 1 MiB (1048576-byte) environment value limit. It is a pre-flight size validation before values are sent to the daemon; the parallel secret limit is 64 KiB.","triggerScenarios":"Passing --var KEY=<value> where KEY's [env] definition is plain text and value.len() > 1 << 20, e.g. embedding a large config blob or dataset inline.","commonSituations":"Inlining a big JSON/YAML config or encoded file as an env var; a generated value (e.g. large JWT or dump) that ballooned past 1 MiB.","solutions":["Reduce the value below 1048576 bytes.","Mount or reference the large payload as a file/artifact instead of an env var.","Split the value across multiple keys if semantically appropriate."],"exampleFix":"// before\n--var CONFIG=$(cat huge.json)\n// after\n--var CONFIG_PATH=/etc/capsule/huge.json","handlingStrategy":"validation","validationCode":"if value.len() > 1024 * 1024 { return Err(\"env value exceeds 1MiB\"); }","typeGuard":null,"tryCatchPattern":"on this error, switch to a file/artifact-based configuration channel instead of env vars, then retry.","preventionTips":["Measure generated values (e.g. with wc -c) before inlining.","Keep large configs as mounted files, not env vars.","Set a stricter local limit (e.g. 256 KiB) in your tooling."],"tags":["validation","limit","env","cli"],"backgroundTag":"value-out-of-range","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"}