{"record":{"id":"f51cd0eb9a3d7ce5","repo":"denoland/deno","slug":"enable-env-must-be-unset-or-set-to-1","errorCode":null,"errorMessage":"{ENABLE_ENV} must be unset or set to 1","messagePattern":"(.+?) must be unset or set to 1","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/build.rs","lineNumber":447,"sourceCode":"    if path.extension().and_then(|s| s.to_str()) == Some(\"ts\") {\n      println!(\"cargo:rerun-if-changed={}\", path.display());\n    }\n  }\n}\n\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!(","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/build.rs#L429-L465","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nexport DENO_USE_STARTUP_ORDER=true\ncargo build --release\n# after\nexport DENO_USE_STARTUP_ORDER=1\ncargo build --release","handlingStrategy":"validation","validationCode":"# run before cargo build\ncase \"${DENO_USE_STARTUP_ORDER:-}\" in\n  \"\"|1) ;;\n  *) echo \"DENO_USE_STARTUP_ORDER must be unset or 1, got '$DENO_USE_STARTUP_ORDER'\"; exit 2;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["build-script","env-var","startup-order","cargo","configuration"],"backgroundTag":"invalid-env-var-value","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}