{"record":{"id":"1be9ca3f0ac4777a","repo":"denoland/deno","slug":"startup-ordering-is-only-supported-by-the-release","errorCode":null,"errorMessage":"startup ordering is only supported by the release profile","messagePattern":"startup ordering is only supported by the release profile","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/build.rs","lineNumber":452,"sourceCode":"\n#[allow(clippy::disallowed_methods, reason = \"build code\")]\nfn emit_startup_order_link_args(out_dir: &Path) {\n  const ENABLE_ENV: &str = \"DENO_USE_STARTUP_ORDER\";\n  const ORDER_FILE_ENV: &str = \"DENO_STARTUP_ORDER_FILE\";\n\n  println!(\"cargo:rerun-if-env-changed={ENABLE_ENV}\");\n  println!(\"cargo:rerun-if-env-changed={ORDER_FILE_ENV}\");\n\n  if env::var_os(ENABLE_ENV).is_none() {\n    return;\n  }\n  if env::var(ENABLE_ENV).ok().as_deref() != Some(\"1\") {\n    panic!(\"{ENABLE_ENV} must be unset or set to 1\");\n  }\n\n  let profile = env::var(\"PROFILE\").unwrap();\n  if profile != \"release\" {\n    panic!(\"startup ordering is only supported by the release profile\");\n  }\n\n  let target = env::var(\"TARGET\").unwrap();\n  match target.as_str() {\n    \"aarch64-apple-darwin\"\n    | \"aarch64-unknown-linux-gnu\"\n    | \"x86_64-unknown-linux-gnu\" => {}\n    _ => return,\n  }\n\n  let source =\n    PathBuf::from(env::var_os(ORDER_FILE_ENV).unwrap_or_else(|| {\n      panic!(\n        \"{ORDER_FILE_ENV} must point to an order generated from the baseline \\\n       release binary using the default linker layout\"\n      )\n    }));\n  let source = source.canonicalize().unwrap_or_else(|error| {","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/build.rs#L434-L470","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nexport DENO_USE_STARTUP_ORDER=1\ncargo build   # panics: debug profile\n# after\nDENO_USE_STARTUP_ORDER=1 cargo build --release","handlingStrategy":"validation","validationCode":"# only enable startup ordering when also building release\nif [ -n \"${DENO_USE_STARTUP_ORDER:-}\" ]; then\n  case \"$*\" in *--release*) ;; *) unset DENO_USE_STARTUP_ORDER;; esac\nfi\ncargo build \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["build-script","cargo","release-profile","startup-order","configuration"],"backgroundTag":"build-profile-mismatch","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}