zed-industries/zed · error

invalid version in Cargo.toml

Error message

invalid version in Cargo.toml

What it means

AppVersion::load panics because the version string baked from Cargo.toml (pkg_version) failed semver parsing. This indicates the crate's version metadata itself is malformed — a build-time invariant violation.

Source

Thrown at crates/release_channel/src/lib.rs:107

struct GlobalAppVersion(Version);

impl Global for GlobalAppVersion {}

/// The version of Zed.
pub struct AppVersion;

impl AppVersion {
    /// Load the app version from env.
    pub fn load(
        pkg_version: &str,
        build_id: Option<&str>,
        commit_sha: Option<AppCommitSha>,
    ) -> Version {
        let mut version: Version = if let Ok(from_env) = env::var("ZED_APP_VERSION") {
            from_env.parse().expect("invalid ZED_APP_VERSION")
        } else {
            pkg_version.parse().expect("invalid version in Cargo.toml")
        };
        let mut pre = String::from(RELEASE_CHANNEL.dev_name());

        if let Some(build_id) = build_id {
            pre.push('.');
            pre.push_str(&build_id);
        }

        if let Some(sha) = commit_sha {
            pre.push('.');
            pre.push_str(&sha.0);
        }
        if let Ok(build) = semver::BuildMetadata::new(&pre) {
            version.build = build;
        }

        version
    }

View on GitHub (pinned to f4178619ac)

Solutions

  1. Correct the version field in the crate's Cargo.toml to valid semver
  2. Check any script that rewrites or injects the version at build time
  3. Fall back to a hardcoded default with logging if parse fails
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/release_channel/src/lib.rs:107 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/0348c150bf3f36e8. Report an issue: GitHub.