{"record":{"id":"ee3687eaf5e85887","repo":"denoland/deno","slug":"failed-to-read-startup-order-error","errorCode":null,"errorMessage":"failed to read startup order {}: {error}","messagePattern":"failed to read startup order (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/build.rs","lineNumber":480,"sourceCode":"\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| {\n    panic!(\n      \"failed to resolve startup order {}: {error}\",\n      source.display()\n    )\n  });\n  println!(\"cargo:rerun-if-changed={}\", source.display());\n\n  let contents = if source.extension().is_some_and(|ext| ext == \"zst\") {\n    let compressed = std::fs::read(&source).unwrap_or_else(|error| {\n      panic!(\"failed to read startup order {}: {error}\", source.display())\n    });\n    zstd::stream::decode_all(compressed.as_slice()).unwrap_or_else(|error| {\n      panic!(\n        \"failed to decompress startup order {}: {error}\",\n        source.display()\n      )\n    })\n  } else {\n    std::fs::read(&source).unwrap_or_else(|error| {\n      panic!(\"failed to read startup order {}: {error}\", source.display())\n    })\n  };\n\n  // Always use the same linker path for generated orders. Full-LTO output can\n  // change when only the order-file path changes.\n  let order_file = out_dir.join(format!(\"startup-order-{target}.order\"));\n  std::fs::write(&order_file, contents).unwrap_or_else(|error| {\n    panic!(","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/build.rs#L462-L498","documentation":"Build-script panic in cli/build.rs. When the order file has a .zst extension its bytes are read with std::fs::read before zstd decompression. This panic fires when that raw read fails — file deleted between canonicalize and read (TOCTOU), permission denied, or an I/O error on the storage holding the compressed order file.","triggerScenarios":"DENO_STARTUP_ORDER_FILE=/path/to/deno.order.zst where the file becomes unreadable mid-build: deleted by a concurrent clean job, chmod 000, a network filesystem hiccup, or a dangling symlink to a compressed artifact.","commonSituations":"CI pipelines that clean the workspace while another step builds; order files stored on NFS/FUSE mounts that transiently fail; a symlink pointing at an artifact not present locally.","solutions":["Verify readability as the build user: `test -r \"$DENO_STARTUP_ORDER_FILE\" && echo ok`","Remove concurrent cleanup (tmpwatch, cargo clean in another job) from the build's directory","Copy the .zst artifact to stable local storage and point DENO_STARTUP_ORDER_FILE at the copy"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"p=\"$DENO_STARTUP_ORDER_FILE\"\ncase \"$p\" in\n  *.zst) test -r \"$p\" || { echo \"cannot read $p\"; exit 2; } ;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep order files on local disk for the duration of the build","Don't run cargo clean or artifact GC concurrently with a build that uses startup ordering"],"tags":["build-script","file-read","io-error","startup-order","zstd"],"backgroundTag":"file-read-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}