denoland/deno · error

{ORDER_FILE_ENV} must point to an order generated from the b

Error message

{ORDER_FILE_ENV} must point to an order generated from the baseline release binary using the default linker layout

What it means

Build-script panic in cli/build.rs. Enabling startup ordering (DENO_USE_STARTUP_ORDER=1) on a release build for a supported target (aarch64/x86_64 darwin or linux-gnu) requires a linker order file produced from a baseline release binary. If DENO_STARTUP_ORDER_FILE is not set at all, the build script panics with this message at the env::var_os unwrap.

Source

Thrown at cli/build.rs:465

    panic!("{ENABLE_ENV} must be unset or set to 1");
  }

  let profile = env::var("PROFILE").unwrap();
  if profile != "release" {
    panic!("startup ordering is only supported by the release profile");
  }

  let target = env::var("TARGET").unwrap();
  match target.as_str() {
    "aarch64-apple-darwin"
    | "aarch64-unknown-linux-gnu"
    | "x86_64-unknown-linux-gnu" => {}
    _ => return,
  }

  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!(

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Generate an order file from a baseline release binary and point the env var at it: `export DENO_STARTUP_ORDER_FILE=/abs/path/deno.order`
  2. If you did not intend to use startup ordering, unset the enable flag: `unset DENO_USE_STARTUP_ORDER`
  3. Verify both variables are exported in the same shell/CI step that runs cargo

Example fix

# before
export DENO_USE_STARTUP_ORDER=1
cargo build --release  # DENO_STARTUP_ORDER_FILE missing
# after
export DENO_USE_STARTUP_ORDER=1
export DENO_STARTUP_ORDER_FILE="$PWD/orders/deno.order"
cargo build --release
Defensive patterns

Strategy: validation

Validate before calling

if [ "${DENO_USE_STARTUP_ORDER:-}" = "1" ] && [ -z "${DENO_STARTUP_ORDER_FILE:-}" ]; then
  echo "DENO_STARTUP_ORDER_FILE is required when DENO_USE_STARTUP_ORDER=1"; exit 2
fi

Prevention

When it happens

Trigger: DENO_USE_STARTUP_ORDER=1 + `cargo build --release` on a supported target while DENO_STARTUP_ORDER_FILE is unset; e.g. enabling the flag to experiment without ever generating a BOLT-style order file.

Common situations: A contributor reads about Deno's startup-order optimization, flips only the enable flag, and forgets the companion variable; or a CI job sets the enable var but the order-file path lives in a secret/artifact that was not downloaded.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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