denoland/deno · error
startup ordering is only supported by the release profile
Error message
startup ordering is only supported by the release profile
What it means
Build-script panic in cli/build.rs. Startup ordering reorders functions based on a profile of a previous run, which is only meaningful for an optimized release binary with full LTO. The build script reads cargo's PROFILE and refuses to continue if DENO_USE_STARTUP_ORDER=1 is combined with a non-release profile (debug, dev, test).
Source
Thrown at cli/build.rs:452
#[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!(
"{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| {View on GitHub (pinned to 9ad36f7a2c)
Solutions
- Build with the release profile: `DENO_USE_STARTUP_ORDER=1 cargo build --release`
- Or unset the flag for debug builds: `unset DENO_USE_STARTUP_ORDER && cargo build`
- Scope the env var to the single release command instead of exporting it globally
Example fix
# before export DENO_USE_STARTUP_ORDER=1 cargo build # panics: debug profile # after DENO_USE_STARTUP_ORDER=1 cargo build --release
Defensive patterns
Strategy: validation
Validate before calling
# only enable startup ordering when also building release
if [ -n "${DENO_USE_STARTUP_ORDER:-}" ]; then
case "$*" in *--release*) ;; *) unset DENO_USE_STARTUP_ORDER;; esac
fi
cargo build "$@" Prevention
- Keep a single wrapper script for release builds that sets both startup-order env vars
- Never export DENO_USE_STARTUP_ORDER in .bashrc/.cargo config where debug builds also run
When it happens
Trigger: DENO_USE_STARTUP_ORDER=1 is exported while running `cargo build` (debug), `cargo check`'s build scripts under a dev profile, `cargo test`, or any non---release invocation of the deno crate.
Common situations: A developer enables startup ordering in their shell or .cargo/config env block and then does a quick debug build for iteration; CI caching an env var from a release job into a debug job.
Related errors
- {ENABLE_ENV} must be unset or set to 1
- {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/1be9ca3f0ac4777a.
Report an issue: GitHub.