astrid-runtime/astrid · error
--var ' ' was supplied more than once
Error message
--var '{key}' was supplied more than once What it means
`from_cli` collects `--var` items into a `HashMap`; `vars.insert` returns `Some(old)` when the key already existed, and that triggers this bail. Duplicate keys in variable overrides are rejected instead of being silently overwritten, so the effective variable set is unambiguous.
Solutions
- Remove or deduplicate the repeated `--var` entries so each key appears once.
- Keep the last intended value only: `--var FOO=2`.
- If both values are needed under different names, rename one key (e.g. `FOO` vs `FOO_ALT`).
- In scripts, build a unique key map before assembling the CLI invocation.
Example fix
// before --var FOO=1 --var FOO=2 // after --var FOO=2
Defensive patterns
Strategy: validation
Validate before calling
fn dedup_vars(items: &[String]) -> Result<std::collections::HashMap<String, String>, String> {
let mut map = std::collections::HashMap::new();
for item in items {
let (k, v) = item.split_once('=')
.ok_or_else(|| format!("bad --var {item:?}"))?;
if map.insert(k.to_string(), v.to_string()).is_some() {
return Err(format!("duplicate --var key: {k}"));
}
}
Ok(map)
} Try / catch
match result {
Err(e) if e.to_string().contains("supplied more than once") =>
eprintln!("A --var key was repeated; keep only the final intended value."),
other => other.expect("install failed"),
} Prevention
- Deduplicate --var flags in scripts before assembling the command line.
- Keep one source of truth for default vars to avoid collisions with user flags.
- Use a map/dict in tooling rather than appending raw flags.
- Grep your wrapper scripts for repeated keys before running installs.
When it happens
Trigger: Passing the same key twice on the command line: `--var FOO=1 --var FOO=2`; a loop in a script emitting a `--var` twice; two sources of flags (config + shell) both adding the same key.
Common situations: Scripts accumulating `--var` flags in an array where a key appears in two entries; copy-paste duplication of flags; build tooling appending default vars that collide with user-supplied ones.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- byte value must be non-negative and finite
- capsule ' ': branch/rev require building from source and…
- capsule name ' ' is invalid (must match ^[a-z][a-z0-9-]*$)
- capsule ' ': tag must not be empty
- capsule ' ': tag must not contain surrounding whitespace
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/aedfbffbe05b9598.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-cli/src/commands/capsule/install.rs:71
#[derive(Debug, Clone, Default)]
pub(super) struct ManualInstallOptions {
pub(super) yes: bool,
pub(super) approve_untrusted: bool,
pub(super) vars: HashMap<String, String>,
}
impl ManualInstallOptions {
fn from_cli(yes: bool, approve_untrusted: bool, items: &[String]) -> anyhow::Result<Self> {
let mut vars = HashMap::new();
for item in items {
let (key, value) = item
.split_once('=')
.ok_or_else(|| anyhow::anyhow!("--var must be KEY=VALUE (got {item:?})"))?;
if key.is_empty() {
bail!("--var has an empty key (got {item:?})");
}
if vars.insert(key.to_string(), value.to_string()).is_some() {
bail!("--var '{key}' was supplied more than once");
}
}
Ok(Self {
yes,
approve_untrusted,
vars,
})
}
}
#[derive(Clone, Copy)]
pub(crate) struct OfflineCapsuleProvenance<'a> {
pub(crate) original_source: &'a str,
pub(crate) resolved_ref: Option<&'a str>,
pub(crate) signer: Option<&'a str>,
pub(crate) signature: Option<&'a str>,
}
View on GitHub (pinned to affd8760f4)