astrid-runtime/astrid · error

--var names no [env] field in {capsule_id}: {key}

Error message

--var names no [env] field in {capsule_id}: {key}

What it means

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.

Source

Thrown at crates/astrid-cli/src/commands/capsule/install_prompts.rs:158

}

/// Collect declared configuration before a daemon-owned install transaction.
///
/// The returned `KEY=VALUE` records are sent in the typed install request so
/// the kernel can stage them before invoking the lifecycle hook and roll them
/// back if installation fails. Existing daemon values are left untouched
/// unless the operator supplied an explicit replacement.
pub(super) fn collect_install_env_fields(
    env_defs: &HashMap<String, EnvDef>,
    capsule_id: &str,
    existing_keys: &std::collections::HashSet<String>,
    supplied: &HashMap<String, String>,
    headless: bool,
    config_path: &Path,
) -> anyhow::Result<Vec<String>> {
    for key in supplied.keys() {
        if !env_defs.contains_key(key) {
            anyhow::bail!("--var names no [env] field in {capsule_id}: {key}");
        }
    }

    let mut collected = serde_json::Map::new();
    for key in existing_keys {
        collected.insert(key.clone(), serde_json::Value::String(String::new()));
    }

    let mut prompted = false;
    let mut values = Vec::new();
    for key in order_env_keys(env_defs) {
        let def = &env_defs[&key];
        let value = if let Some(value) = supplied.get(&key) {
            value.clone()
        } else if existing_keys.contains(&key) {
            continue;
        } else if headless {
            let env_key = headless_env_key(&key);

View on GitHub (pinned to affd8760f4)

Solutions

  1. Correct the --var key to match a declared [env] field in the capsule manifest.
  2. Drop the --var flag if the field no longer exists in this capsule version; interactive mode will prompt for what is needed.
  3. Regenerate or review your install script/CI config against the current capsule version's manifest.

Example fix

// before (CI step)
astrid capsule install github:org/repo --var endpoint_url=https://...   # manifest declares endpoint
// after
astrid capsule install github:org/repo --var endpoint=https://...
Defensive patterns

Strategy: validation

Validate before calling

// gate CI install steps on declared env fields
let declared: HashSet<&str> = manifest.env.keys().map(|k| k.as_str()).collect();
for key in supplied_vars.keys() {
    assert!(declared.contains(key.as_str()), "--var {key} not declared");
}

Prevention

When it happens

Trigger: 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.

Common situations: Typo in a --var key; stale automation scripts passing fields removed in a newer capsule release; mixing up field names between similar capsules.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/a09915b9ec225c88. Report an issue: GitHub.