denoland/deno · error
failed to validate startup order {}: {error}
Error message
failed to validate startup order {}: {error} What it means
Build-script panic in cli/build.rs. Immediately after writing the copied order file, the script reads it back with fs::read_to_string to validate its contents (counting non-empty, non-comment lines). read_to_string requires valid UTF-8; a non-UTF-8 order file (binary garbage, wrong encoding, LZ4/gzip bytes despite the extension) makes this read fail and panics as "failed to validate startup order <path>".
Source
Thrown at cli/build.rs:505
})
} else {
std::fs::read(&source).unwrap_or_else(|error| {
panic!("failed to read startup order {}: {error}", source.display())
})
};
// Always use the same linker path for generated orders. Full-LTO output can
// change when only the order-file path changes.
let order_file = out_dir.join(format!("startup-order-{target}.order"));
std::fs::write(&order_file, contents).unwrap_or_else(|error| {
panic!(
"failed to write startup order {}: {error}",
order_file.display()
)
});
let contents = std::fs::read_to_string(&order_file).unwrap_or_else(|error| {
panic!(
"failed to validate startup order {}: {error}",
order_file.display()
)
});
let symbol_count = contents
.lines()
.filter(|line| !line.is_empty() && !line.starts_with('#'))
.count();
if symbol_count < 1_000 {
panic!(
"startup order {} has only {symbol_count} symbols",
order_file.display()
);
}
let order_file = order_file.canonicalize().unwrap();
match target.as_str() {
"aarch64-apple-darwin" => println!(View on GitHub (pinned to 9ad36f7a2c)
Solutions
- Check encoding: `file "$DENO_STARTUP_ORDER_FILE"` — it must be ASCII/UTF-8 text, one symbol per line
- If the payload is another compression format, decompress it and supply the raw text file (or properly .zst-compress it)
- Regenerate the order file with the supported generator so it is plain text lines with optional # comments
Example fix
# before DENO_STARTUP_ORDER_FILE=deno.order.gz # gz bytes, not utf-8 # after gunzip -c deno.order.gz > deno.order DENO_STARTUP_ORDER_FILE=$PWD/deno.order
Defensive patterns
Strategy: validation
Validate before calling
file "$DENO_STARTUP_ORDER_FILE" # expect: ASCII text / UTF-8 iconv -f utf-8 -t utf-8 "$DENO_STARTUP_ORDER_FILE" >/dev/null || echo 'not valid UTF-8'
Prevention
- Generate order files as plain UTF-8/ASCII text, one symbol per line
- On Windows avoid PowerShell redirects that emit UTF-16 (use cmd redirect or set output encoding)
When it happens
Trigger: The decoded order-file bytes are not UTF-8 text — e.g. the file is still compressed under a non-.zst name, is UTF-16 output from a PowerShell redirect, or the .zst decoded to something that is not an order list.
Common situations: Toolchains on Windows writing UTF-16 with BOM; a generation script emitting the wrong format; an artifact naming mismatch (gzip'd file named .order).
Related errors
- startup order {} has only {symbol_count} symbols
- Unexpected 'fn' field in options, bench function is already
- ERR_INVALID_ARG_VALUE
- {ENABLE_ENV} must be unset or set to 1
- startup ordering is only supported by the release profile
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/c5c7dfd77360561d.
Report an issue: GitHub.