denoland/deno · error

failed to read startup order {}: {error}

Error message

failed to read startup order {}: {error}

What it means

Build-script panic in cli/build.rs. When the order file has a .zst extension its bytes are read with std::fs::read before zstd decompression. This panic fires when that raw read fails — file deleted between canonicalize and read (TOCTOU), permission denied, or an I/O error on the storage holding the compressed order file.

Source

Thrown at cli/build.rs:480

  let source =
    PathBuf::from(env::var_os(ORDER_FILE_ENV).unwrap_or_else(|| {
      panic!(
        "{ORDER_FILE_ENV} must point to an order generated from the baseline \
       release binary using the default linker layout"
      )
    }));
  let source = source.canonicalize().unwrap_or_else(|error| {
    panic!(
      "failed to resolve startup order {}: {error}",
      source.display()
    )
  });
  println!("cargo:rerun-if-changed={}", source.display());

  let contents = if source.extension().is_some_and(|ext| ext == "zst") {
    let compressed = std::fs::read(&source).unwrap_or_else(|error| {
      panic!("failed to read startup order {}: {error}", source.display())
    });
    zstd::stream::decode_all(compressed.as_slice()).unwrap_or_else(|error| {
      panic!(
        "failed to decompress startup order {}: {error}",
        source.display()
      )
    })
  } else {
    std::fs::read(&source).unwrap_or_else(|error| {
      panic!("failed to read startup order {}: {error}", source.display())
    })
  };

  // Always use the same linker path for generated orders. Full-LTO output can
  // change when only the order-file path changes.
  let order_file = out_dir.join(format!("startup-order-{target}.order"));
  std::fs::write(&order_file, contents).unwrap_or_else(|error| {
    panic!(

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Verify readability as the build user: `test -r "$DENO_STARTUP_ORDER_FILE" && echo ok`
  2. Remove concurrent cleanup (tmpwatch, cargo clean in another job) from the build's directory
  3. Copy the .zst artifact to stable local storage and point DENO_STARTUP_ORDER_FILE at the copy
Defensive patterns

Strategy: validation

Validate before calling

p="$DENO_STARTUP_ORDER_FILE"
case "$p" in
  *.zst) test -r "$p" || { echo "cannot read $p"; exit 2; } ;;
esac

Prevention

When it happens

Trigger: DENO_STARTUP_ORDER_FILE=/path/to/deno.order.zst where the file becomes unreadable mid-build: deleted by a concurrent clean job, chmod 000, a network filesystem hiccup, or a dangling symlink to a compressed artifact.

Common situations: CI pipelines that clean the workspace while another step builds; order files stored on NFS/FUSE mounts that transiently fail; a symlink pointing at an artifact not present locally.

Related errors


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