Kuberwastaken/claurst · error

--version requires an argument

Error message

--version requires an argument

What it means

Fired by the upgrade subcommand's argument parser when the `-v`/`--version` flag is passed as the last argument, so the iterator has no following token to consume as the requested version. The flag is defined to take a mandatory value (a release tag such as `v1.2.3`); without it the parser cannot resolve which release to download, so it aborts with a validation error instead of silently upgrading to latest. Not a runtime or network failure — purely a command-line usage error.

Solutions

  1. Pass an explicit version: `claurst upgrade --version 1.2.3`
  2. Omit the flag entirely to upgrade to the latest release
  3. Run `claurst upgrade --help` for usage
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src-rust/crates/cli/src/upgrade.rs:32 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10). Data as JSON: /api/errors/21163d00fd39b845. Report an issue: GitHub.

Appendix: source

Thrown at src-rust/crates/cli/src/upgrade.rs:32

const REPO: &str = "Kuberwastaken/claurst";
const APP: &str = "claurst";

pub async fn run_upgrade(args: &[String]) -> Result<()> {
    // -------- arg parsing --------
    let mut requested_version: Option<String> = None;
    let mut force = false;
    let mut iter = args.iter();
    while let Some(arg) = iter.next() {
        match arg.as_str() {
            "-h" | "--help" => {
                print_help();
                return Ok(());
            }
            "-v" | "--version" => {
                requested_version = iter.next().cloned();
                if requested_version.is_none() {
                    bail!("--version requires an argument");
                }
            }
            "--force" | "-f" => force = true,
            unknown => bail!("Unknown option: {}", unknown),
        }
    }

    let current_version = env!("CARGO_PKG_VERSION").to_string();
    println!("Current version: {}", current_version);

    // -------- detect target --------
    let target = detect_target()?;
    println!("Detected target: {}", target);

    // -------- resolve target version --------
    let target_version = if let Some(v) = requested_version {
        v.trim_start_matches('v').to_string()
    } else {

View on GitHub (pinned to b0637c97ec)