astrid-runtime/astrid · error

distro.astrid-version '{av}' is not a valid semver requireme

Error message

distro.astrid-version '{av}' is not a valid semver requirement

What it means

validate_manifest in the astrid-cli distro validator rejects a distro manifest whose `distro.astrid-version` field is set but is not a parseable semver requirement (per `semver::VersionReq::parse`). This field pins which versions of the astrid toolchain the distro works with, so it must be a valid requirement expression like `^1.2` or `>=0.8, <2.0`. The library throws early so an invalid pin never silently fails during resolution.

Source

Thrown at crates/astrid-cli/src/commands/distro/validate.rs:106

        anyhow::bail!(
            "distro.id '{}' is invalid (must match ^[a-z][a-z0-9-]*$)",
            manifest.distro.id,
        );
    }

    // Distro version is valid semver.
    if semver::Version::parse(&manifest.distro.version).is_err() {
        anyhow::bail!(
            "distro.version '{}' is not valid semver",
            manifest.distro.version,
        );
    }

    // astrid-version is valid semver requirement (if set).
    if let Some(ref av) = manifest.distro.astrid_version
        && semver::VersionReq::parse(av).is_err()
    {
        anyhow::bail!("distro.astrid-version '{av}' is not a valid semver requirement");
    }

    // Requires version strings are valid semver requirements.
    for (ns, ifaces) in &manifest.distro.requires {
        for (name, req) in ifaces {
            if semver::VersionReq::parse(req).is_err() {
                anyhow::bail!(
                    "distro.requires.{ns}.{name} '{req}' is not a valid semver requirement",
                );
            }
        }
    }

    // At least one capsule.
    if manifest.capsules.is_empty() {
        anyhow::bail!("distro must contain at least one capsule");
    }

View on GitHub (pinned to affd8760f4)

Solutions

  1. Open the manifest and fix `distro.astrid-version` to a valid semver requirement (e.g. `^1.2`, `=1.4.2`, `>=0.8, <2.0`).
  2. If you meant a concrete version, use an exact requirement like `=1.2.3`.
  3. Remove the field entirely if you do not need to constrain the astrid toolchain version.
  4. Validate locally with `semver` tooling (or `cargo add`-style checks) before re-running the distro build.

Example fix

# before
[distro]
astrid-version = "latest"

# after
[distro]
astrid-version = "^1.4"
Defensive patterns

Strategy: validation

Validate before calling

fn valid_astrid_version(av: &str) -> bool {
    av.is_empty() || semver::VersionReq::parse(av).is_ok()
}
if let Some(av) = &manifest.distro.astrid_version {
    assert!(valid_astrid_version(av), "astrid-version '{}' is not a semver requirement", av);
}

Type guard

fn is_semver_req(s: &str) -> bool {
    semver::VersionReq::parse(s).is_ok()
}

Try / catch

match build_distro(&manifest) {
    Err(e) if e.to_string().contains("is not a valid semver requirement") => {
        eprintln!("fix distro.astrid-version: {e}");
    }
    Err(e) => return Err(e),
    Ok(d) => d,
}

Prevention

When it happens

Trigger: Building/validating a distro manifest where `distro.astrid-version` is a non-empty string that fails semver VersionReq parsing — e.g. `astrid-version: "1.2.x-*"`, `"v1.0"`, `"latest"`, `"^1.2.3.4"`, or stray whitespace/typo.

Common situations: Hand-editing a distro.toml/manifest and typing a git tag or plain version instead of a semver requirement; copying a Cargo-style requirement with unsupported operators; accidentally quoting `latest` or a branch name into the field.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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