denoland/deno · error

deno.json `version` "{version}" cannot be used as a Debian/R

Error message

deno.json `version` "{version}" cannot be used as a Debian/RPM package version: it must start with a digit

What it means

This error is thrown while validating the `version` field of deno.json when it is used as a Debian/RPM package version. Debian and RPM both require package versions to start with a digit, so a config version beginning with a non-digit (e.g. `v1.2.3` or `beta-1`) is rejected. If no `version` is set in deno.json, a fixed LINUX_PACKAGE_VERSION default is used instead and no error occurs.

Source

Thrown at cli/tools/desktop.rs:3892

/// here: the package would build fine and only fail at `dpkg -i`/`rpm -i`
/// time with an opaque "invalid version" error. Debian policy 5.6.12 requires
/// the upstream version to start with a digit and restricts it to
/// alphanumerics plus `. + - ~` (`:` and `-` being reserved as the epoch and
/// revision separators, neither of which we emit); RPM's Version tag is
/// similarly restricted and additionally forbids `-`.
///
/// The one transformation applied is `-` → `~`: neither format reads `-` in
/// the upstream-version position with the meaning users expect from a semver
/// prerelease, while both order `~` as "less than the release" — the semver
/// intent.
fn linux_package_version(
  config_version: Option<&str>,
) -> Result<String, AnyError> {
  let Some(version) = config_version else {
    return Ok(LINUX_PACKAGE_VERSION.to_string());
  };
  if !version.starts_with(|c: char| c.is_ascii_digit()) {
    bail!(
      "deno.json `version` \"{version}\" cannot be used as a Debian/RPM package version: it must start with a digit"
    );
  }
  if let Some(c) = version.chars().find(|c| {
    !(c.is_ascii_alphanumeric() || matches!(c, '.' | '+' | '-' | '~'))
  }) {
    bail!(
      "deno.json `version` \"{version}\" cannot be used as a Debian/RPM package version: the character '{c}' is not allowed (only alphanumerics, '.', '+', '-' and '~')"
    );
  }
  Ok(version.replace('-', "~"))
}

/// Map a target triple (or the host arch when `target` is None) to a Debian
/// architecture name. Debian arch names differ from the triple's leading
/// component (`x86_64` → `amd64`, `aarch64` → `arm64`).
fn debian_arch_for_target(
  target: Option<&str>,

View on GitHub (pinned to f7822238ca)

Solutions

  1. Change the deno.json `version` to start with a digit, e.g. strip a leading 'v'.
  2. Remove the `version` field from deno.json to fall back to the default LINUX_PACKAGE_VERSION.
  3. Move pre-release wording after the numeric part, e.g. "1.0.0-alpha" instead of "alpha-1.0.0".

Example fix

// deno.json
// before
{ "version": "v1.2.3" }
// after
{ "version": "1.2.3" }
Defensive patterns

Strategy: validation

Validate before calling

const version = config.version;
if (version && !/^[0-9]/.test(version)) {
  throw new Error(`deno.json version "${version}" must start with a digit for Debian/RPM packaging`);
}

Type guard

function isValidDebRpmVersionStart(version: string): boolean {
  return /^[0-9]/.test(version);
}

Try / catch

try {
  await buildDesktopApp({ format: "deb" });
} catch (err) {
  if (String(err.message).includes("must start with a digit")) {
    console.error("Strip the leading 'v' or non-digit prefix from deno.json `version`.");
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Setting a `version` in deno.json that does not start with an ASCII digit (e.g. "v1.0.0", "alpha1") and running a desktop build targeting .deb/.rpm output.

Common situations: Prefixing versions with 'v' by habit (common Git-tag style), using pre-release labels at the start of the version string, or copying a version string from a tag name into deno.json.

Related errors


AI-assisted analysis of denoland/deno@f7822238ca (2026-08-29). Data as JSON: /api/errors/efd8a88906ce5dd1. Report an issue: GitHub.