{"record":{"id":"9b9f37304a0e8dc4","repo":"astrid-runtime/astrid","slug":"grant-capsules-is-not-supported-for-shuttle-ins","errorCode":null,"errorMessage":"--grant-capsules is not supported for .shuttle installs yet — install first, then grant with `astrid --principal {operator} agent modify {target} --add-capsule <name>` for each installed capsule.","messagePattern":"--grant-capsules is not supported for \\.shuttle installs yet — install first, then grant with `astrid --principal (.+?) agent modify (.+?) --add-capsule <name>` for each installed capsule\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/init.rs","lineNumber":93,"sourceCode":"            bail!(\"--var has an empty key (got {item:?})\");\n        }\n        map.insert(key.to_string(), value.to_string());\n    }\n    Ok(map)\n}\n\n/// Enforce source flags before this flow can create runtime state.\nfn validate_install_source(\n    distro_source: &str,\n    opts: &InitOpts,\n    operator: &astrid_core::PrincipalId,\n    target: &astrid_core::PrincipalId,\n) -> anyhow::Result<bool> {\n    let shuttle_install = distro_source.ends_with(\".shuttle\");\n    // `--grant-capsules` is not wired for `.shuttle`; fail rather than silently\n    // skip the requested grants and point at the legacy manual command.\n    if shuttle_install && opts.grant_capsules {\n        bail!(\n            \"--grant-capsules is not supported for .shuttle installs yet — \\\n             install first, then grant with `astrid --principal {operator} \\\n             agent modify {target} \\\n             --add-capsule <name>` for each installed capsule.\"\n        );\n    }\n    Ok(shuttle_install)\n}\n\n/// Run the init flow: workspace setup + distro-based capsule installation.\npub(crate) async fn run_init(distro_source: &str, opts: &InitOpts) -> anyhow::Result<()> {\n    let home = AstridHome::resolve()?;\n    let operator = crate::principal::current();\n    let target = opts.target_principal.clone();\n\n    // `--grant-capsules` is only meaningful when a distro install is\n    // resolving the capsule set to grant. Reject an empty source up front so\n    // the flag can never be silently honoured without a distro.","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/init.rs#L75-L111","documentation":"validate_install_source rejects combining --grant-capsules with a .shuttle distro source. Capsule granting is not wired up for .shuttle archives, so the CLI fails loudly instead of silently skipping the requested grants, and points the user at the legacy manual grant command.","triggerScenarios":"Running init with a distro source ending in '.shuttle' while opts.grant_capsules is true (i.e. --grant-capsules was passed).","commonSituations":"Automating installs from a self-contained .shuttle archive and passing --grant-capsules out of habit from GitHub-sourced distros; CI scripts that always include --grant-capsules.","solutions":["Drop --grant-capsules from the .shuttle install command.","After the install completes, grant per capsule with: astrid --principal {operator} agent modify {target} --add-capsule <name>.","Alternatively use a non-.shuttle source (e.g. @owner/repo) if you need automatic capsule granting."],"exampleFix":"// before\nastrid init @acme/distro --shuttle --grant-capsules\n// after\nastrid init @acme/distro --shuttle\nastrid --principal <operator> agent modify <target> --add-capsule <name>","handlingStrategy":"validation","validationCode":"if source.ends_with(\".shuttle\") && grant_capsules {\n    eprintln!(\"--grant-capsules is unsupported for .shuttle installs\");\n    std::process::exit(2);\n}","typeGuard":null,"tryCatchPattern":"match validate_install_source(source, &opts, target) {\n    Ok(granted) => proceed(granted),\n    Err(e) => eprintln!(\"{e:#}\"),\n}","preventionTips":["Keep install flags per source type: no --grant-capsules with .shuttle.","Script the post-install grant loop (`agent modify --add-capsule`) instead.","Document flag compatibility in CI templates."],"tags":["cli","install","unsupported-feature","shuttle"],"backgroundTag":"unsupported-operation","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}