nikivdev/code · error

Unsupported architecture

Error message

Unsupported architecture

What it means

Returned when the self-upgrade routine detects a CPU architecture for which no prebuilt release binary is published.

Source

Thrown at src/upgrade.rs:175

    bail!("Unsupported operating system for self-upgrade (only macOS/Linux supported)");
}

fn detect_legacy_platform() -> Result<(&'static str, &'static str)> {
    let os = if cfg!(target_os = "macos") {
        "darwin"
    } else if cfg!(target_os = "linux") {
        "linux"
    } else {
        bail!("Unsupported operating system for self-upgrade (only macOS/Linux supported)");
    };

    let arch = if cfg!(target_arch = "aarch64") {
        "arm64"
    } else if cfg!(target_arch = "x86_64") {
        "amd64"
    } else {
        bail!("Unsupported architecture");
    };

    Ok((os, arch))
}

/// Fetch the latest release info from GitHub.
fn fetch_latest_release(client: &Client) -> Result<GitHubRelease> {
    let (owner, repo) = upgrade_repo()?;
    let url = format!(
        "https://api.github.com/repos/{}/{}/releases/latest",
        owner, repo
    );

    let mut request = client
        .get(&url)
        .header("User-Agent", format!("flow/{}", current_version()))
        .header("Accept", "application/vnd.github.v3+json")
        .timeout(Duration::from_secs(30));

View on GitHub (pinned to a747e741ae)

Solutions

  1. Check available release assets for supported architectures
  2. Build from source for the unsupported architecture

Example fix

// before
# 32-bit install on Raspberry Pi OS (armv7)
flow upgrade
// after
# install arm64 build, then
flow upgrade
Defensive patterns

Strategy: validation

Validate before calling

fn is_64bit() -> bool {
    matches!(std::env::consts::ARCH, "x86_64" | "aarch64")
}
if !is_64bit() {
    eprintln!("only amd64/arm64 legacy assets exist; install the 64-bit build");
    return;
}

Try / catch

match detect_legacy_platform() {
    Ok((os, arch)) => { /* use asset */ }
    Err(e) if e.to_string().contains("Unsupported architecture") => {
        eprintln!("install a 64-bit (amd64/arm64) build of the tool first");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Self-upgrade on macOS/Linux with a build compiled for a 32-bit or exotic architecture (armv7, i686, riscv, etc.).

Common situations: Running an i686 (32-bit) build on Linux, or an armv7 build on a Raspberry Pi 3 in 32-bit mode; legacy installs on non-64-bit systems.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/6469a59b12f83c25. Report an issue: GitHub.