astrid-runtime/astrid · error

distro.version '{}' is not valid semver

Error message

distro.version '{}' is not valid semver

What it means

validate_manifest parses distro.version with the semver crate and rejects values that are not valid semantic versions. Downstream tooling (comparison, lock files, update checks) depends on strict semver.

Source

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

    // Schema version.
    if manifest.schema_version != SCHEMA_VERSION {
        anyhow::bail!(
            "unsupported schema-version {} (expected {SCHEMA_VERSION})",
            manifest.schema_version,
        );
    }

    // Distro ID format.
    if !is_valid_id(&manifest.distro.id) {
        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",

View on GitHub (pinned to affd8760f4)

Solutions

  1. Rewrite distro.version as a full semver string (MAJOR.MINOR.PATCH, optional -prerelease)
  2. Remove a leading 'v' or other non-numeric prefixes
  3. Validate locally with any semver checker before re-parsing

Example fix

// before
// [distro]
// version = "v1.0"
// after
// [distro]
// version = "1.0.0"
Defensive patterns

Strategy: validation

Validate before calling

if semver::Version::parse(&manifest.distro.version).is_err() {
    return Err(anyhow!("distro.version is not valid semver"));
}

Prevention

When it happens

Trigger: Distro.toml with a version like "1.0", "v1.2.3", "1.2.3-beta" missing a valid prerelease form, or any free-form string.

Common situations: Omitting the patch segment; prefixing with 'v'; using dates or build strings as versions; typos like "1..2".

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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