denoland/deno · error · RangeError

Invalid range. Start value is bigger than end value

Error message

Invalid range. Start value is bigger than end value: [${start}, ${end}]

What it means

After resolving a version from the npm.jsr.io metadata document, the code walks `versions[<version>].dist.tarball` to find where to download the package tarball. If any hop in that chain is missing — the version entry exists but has no `dist` object or no `tarball` string — the metadata is considered malformed for that version and this error names the registry name and resolved version.

Solutions

  1. Retry after a short delay — npm.jsr.io replication lag usually resolves itself
  2. Pin a different, known-good version of the jsr: dependency in your import map/deno.json
  3. Verify what the registry reports: fetch the metadata URL and check `versions[<version>].dist.tarball` yourself
  4. If it persists for a stable published version, report it to the JSR maintainers

Example fix

# before (version mirror metadata incomplete)
"imports": { "@luca/flag": "jsr:@luca/flag@1.0.2" }
# No tarball URL for @luca/flag@1.0.2

# after
"imports": { "@luca/flag": "jsr:@luca/flag@1.0.1" }  # or retry once replication catches up
Defensive patterns

Strategy: retry

Validate before calling

# Confirm the exact version has a tarball URL in published metadata
curl -fsSL https://npm.jsr.io/@scope/pkg | jq -e --arg v "$VER" '.versions[$v].dist.tarball != null'

Try / catch

On /No tarball URL for/ in automation, retry after ~a minute (replication lag); after N failures, programmatically fall back to the previously pinned good version from the lockfile/deno.json and flag the package for investigation.

Prevention

When it happens

Trigger: The fetched metadata JSON parses but lacks `versions -> <resolved_version> -> dist -> tarball`: partially replicated metadata on npm.jsr.io (version listed but dist data missing), a yanked/partially-published release, or a registry-side schema change. Distinct from a parse failure (that is the sibling 'Failed to parse metadata' error).

Common situations: A jsr package published moments ago whose npm-mirror metadata has not fully replicated; yanked versions; registry incidents; pinning an exact version that the mirror cannot serve a tarball for.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/cf5df994ba422d90. Report an issue: GitHub.

Appendix: source

Thrown at cli/js/40_lint.js:395

    return this.sourceCode;
  }

  /**
   * @param {Deno.lint.ReportData} data
   */
  report(data) {
    const range = data.node ? data.node.range : data.range ? data.range : null;
    if (range == null) {
      throw new Error(
        "Either `node` or `range` must be provided when reporting an error",
      );
    }

    const start = range[0];
    const end = range[1];

    if (start > end) {
      throw new RangeError(
        `Invalid range. Start value is bigger than end value: [${start}, ${end}]`,
      );
    }

    /** @type {Deno.lint.Fix[]} */
    const fixes = [];

    if (typeof data.fix === "function") {
      const fixer = new Fixer();
      const result = data.fix(fixer);

      if (Symbol.iterator in result) {
        for (const fix of result) {
          fixes.push(fix);
        }
      } else {
        fixes.push(result);
      }

View on GitHub (pinned to 9ad36f7a2c)