astrid-runtime/astrid · error

exactly one of --as, --fleet, or --admin is required

Error message

exactly one of --as, --fleet, or --admin is required

What it means

The storage mount `view` command resolves its principal scope from exactly one of three flags: --as (a principal), --fleet (a fleet id), or --admin. MountArgs::view maps the flag combination to a MountView and bails when zero flags or more than one flag is supplied. The mount must be unambiguously scoped to a single identity.

Source

Thrown at crates/astrid-cli/src/commands/storage.rs:87

    /// Native mount point or Windows drive target.
    #[arg(value_name = "MOUNTPOINT")]
    mountpoint: PathBuf,
}

#[derive(Debug, Clone, PartialEq, Eq)]
enum MountView {
    Principal(PrincipalId),
    Fleet(FleetUid),
    Admin,
}

impl MountArgs {
    fn view(&self) -> Result<MountView> {
        match (&self.as_principal, self.fleet, self.admin) {
            (Some(principal), None, false) => Ok(MountView::Principal(principal.clone())),
            (None, Some(fleet), false) => Ok(MountView::Fleet(fleet)),
            (None, None, true) => Ok(MountView::Admin),
            _ => bail!("exactly one of --as, --fleet, or --admin is required"),
        }
    }

    fn access(&self, view: &MountView) -> &'static str {
        if self.read_only || (matches!(view, MountView::Admin) && !self.read_write) {
            "read-only"
        } else {
            "read-write"
        }
    }
}

/// Run a storage command through the platform's lifecycle-independent provider.
pub(crate) fn run(command: StorageCommand) -> Result<ExitCode> {
    let provider_name = platform_provider_name();
    let provider = crate::bootstrap::find_coinstalled_companion_binary(provider_name)
        .with_context(|| {
            format!(

View on GitHub (pinned to affd8760f4)

Solutions

  1. Pass exactly one of: `--as <principal>`, `--fleet <id>`, or `--admin`.
  2. Remove any duplicate/scoped flags from the command line or script.
  3. Check `astrid storage mount --help` for the accepted flag combinations.

Example fix

// before
astrid storage mount --as alice --fleet eng
# error: exactly one of --as, --fleet, or --admin is required

// after
astrid storage mount --as alice
Defensive patterns

Strategy: validation

Validate before calling

fn scoped_flags_ok(as_: &Option<String>, fleet: &Option<String>, admin: bool) -> bool {
    let count = as_.is_some() as usize + fleet.is_some() as usize + admin as usize;
    count == 1
}

Try / catch

match mount_args.view() {
    Err(e) if e.to_string().contains("exactly one of") => {
        eprintln!("Pass exactly one of --as, --fleet, or --admin.");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `astrid storage mount`/`view` with no scoping flag, with two or more of --as/--fleet/--admin together, or with --admin combined with --read-write in a way that falls through to the catch-all (any non-exact combination hits the bail).

Common situations: Copy-pasted command lines that keep a stale flag; scripts adding --admin for convenience alongside --as; forgetting which flag the subcommand requires.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


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