denoland/deno · error
{ENABLE_ENV} must be unset or set to 1
Error message
{ENABLE_ENV} must be unset or set to 1 What it means
Build-script panic in cli/build.rs from emit_startup_order_link_args(). Startup ordering (linker function reordering via an order file) is opt-in at build time with DENO_USE_STARTUP_ORDER, and the gate is strict: the variable must be either unset or exactly the string "1". Any other value aborts the whole cargo build.
Source
Thrown at cli/build.rs:447
if path.extension().and_then(|s| s.to_str()) == Some("ts") {
println!("cargo:rerun-if-changed={}", path.display());
}
}
}
#[allow(clippy::disallowed_methods, reason = "build code")]
fn emit_startup_order_link_args(out_dir: &Path) {
const ENABLE_ENV: &str = "DENO_USE_STARTUP_ORDER";
const ORDER_FILE_ENV: &str = "DENO_STARTUP_ORDER_FILE";
println!("cargo:rerun-if-env-changed={ENABLE_ENV}");
println!("cargo:rerun-if-env-changed={ORDER_FILE_ENV}");
if env::var_os(ENABLE_ENV).is_none() {
return;
}
if env::var(ENABLE_ENV).ok().as_deref() != Some("1") {
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!(View on GitHub (pinned to 9ad36f7a2c)
Solutions
- Set the variable to exactly 1: `export DENO_USE_STARTUP_ORDER=1`
- Or leave it unset entirely if you do not want startup ordering: `unset DENO_USE_STARTUP_ORDER`
- Check for stray whitespace/quotes: `printf '%s' "$DENO_USE_STARTUP_ORDER" | od -c` and re-export a clean value
Example fix
# before export DENO_USE_STARTUP_ORDER=true cargo build --release # after export DENO_USE_STARTUP_ORDER=1 cargo build --release
Defensive patterns
Strategy: validation
Validate before calling
# run before cargo build
case "${DENO_USE_STARTUP_ORDER:-}" in
""|1) ;;
*) echo "DENO_USE_STARTUP_ORDER must be unset or 1, got '$DENO_USE_STARTUP_ORDER'"; exit 2;;
esac Prevention
- Treat DENO_USE_STARTUP_ORDER as a tri-state (unset / 1), never a general boolean
- Set it inline on the exact cargo release command instead of exporting globally
- In CI, print relevant DENO_* vars at job start to catch misconfigured env
When it happens
Trigger: Running `cargo build` for the deno crate with DENO_USE_STARTUP_ORDER set to anything except unset or "1" — typical offenders are "true", "yes", "on", "1.0", or trailing whitespace from an CI env var.
Common situations: A contributor or CI pipeline copies a generic boolean env-var convention (0/1/true/false) from other DENO_* variables to the startup-order flag, or an env file exports DENO_USE_STARTUP_ORDER=true expecting it to enable PGO/BOLT-style startup ordering.
Related errors
- startup ordering is only supported by the release profile
- {ORDER_FILE_ENV} must point to an order generated from the b
- expected file "{file}" to exist
- cli/laufey_sums.lock has no pinned laufey version — populate
- cli/laufey_sums.lock pins Laufey v{pinned} but this build ex
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/f51cd0eb9a3d7ce5.
Report an issue: GitHub.