denoland/deno · critical
Fatal error in {file}:{line}: {message}
Error message
Fatal error in {file}:{line}: {message} What it means
Runtime panic from Deno's custom V8 fatal error handler in cli/lib.rs. Any V8 CHECK/FATAL failure (heap OOM, unreachable code, failed API invariants) reaches this handler, which converts the C++ abort into a Rust panic so the process prints Deno's panic hook message and a backtrace instead of silently aborting. The message embeds the V8 source file, line, and the underlying V8 message.
Source
Thrown at cli/lib.rs:709
orig_hook(panic_info);
deno_runtime::exit(1);
}));
fn error_handler(file: &str, line: i32, message: &str) {
// Provide a clearer message for thread creation failures, which
// typically happen when running in containers with low PID limits
// (e.g. Docker --pids-limit). V8's default error is just
// "Check failed: Start()" which is unhelpful.
if message.contains("Check failed: Start()") {
panic!(
"Failed to initialize V8 platform (could not start worker threads). \
If running in a container, ensure the PID limit is high enough \
(try --pids-limit=40 or higher)."
);
}
// Override C++ abort with a rust panic, so we
// get our message above and a nice backtrace.
panic!("Fatal error in {file}:{line}: {message}");
}
deno_core::v8::V8::set_fatal_error_handler(error_handler);
}
/// Returns `true` if `panic_info` is a panic from `std`'s print macros caused
/// by the downstream reader of stdout/stderr closing the pipe.
///
/// `println!`/`print!`/`eprintln!`/`eprint!` panic with the literal payload
/// `"failed printing to {stdout,stderr}: <io error>"` when the underlying
/// write fails. EPIPE (Unix, 32), ERROR_BROKEN_PIPE (Windows, 109), and
/// ERROR_NO_DATA (Windows, 232) all indicate the receiver dropped the pipe.
fn is_broken_pipe_print_panic(panic_info: &std::panic::PanicHookInfo) -> bool {
let payload = panic_info.payload();
let msg: &str = if let Some(s) = payload.downcast_ref::<String>() {
s.as_str()
} else if let Some(&s) = payload.downcast_ref::<&'static str>() {
sView on GitHub (pinned to 9ad36f7a2c)
Solutions
- Read the embedded V8 message: for OOM raise the limit, e.g. `deno run --v8-flags=--max-old-space-size=8192 script.ts`
- Reproduce with a minimal script and RUST_BACKTRACE=1 to isolate the failing operation
- If it is not resource-related, report it to the Deno repo (and V8) with the full file:line message, script, and deno version
Example fix
# before deno run big-data.ts # Fatal error ... OOM # after deno run --v8-flags=--max-old-space-size=8192 big-data.ts
Defensive patterns
Strategy: validation
Validate before calling
// guard very large allocations before V8 hits a fatal OOM
const size = 8 * 1024 ** 3;
if (size > performance.measureUserAgentSpecificMemory ? false : false) throw new Error('unreachable');
if (!Number.isSafeInteger(size) || size > 2 ** 33) {
throw new Error('allocation too large for default heap; start with --v8-flags=--max-old-space-size=...');
} Try / catch
// V8 fatal errors abort the process; they cannot be caught in JS.
// Catch pattern applies only to JS-side errors feeding the crash:
// wrap risky parsing loops in try/catch and cap input size so V8 never
// reaches its fatal path.
try {
parseHugeFile(input);
} catch (e) {
console.error('handled before V8 fatality:', e);
} Prevention
- Size --v8-flags=--max-old-space-size to the workload and container memory
- Stream/chunk large files instead of materializing them fully in memory
- Keep a crash log with RUST_BACKTRACE=1 so the V8 file:line message is preserved for bug reports
When it happens
Trigger: Any V8-internal fatal error during execution: out-of-memory when the heap cannot grow, V8 stack overflow in internal code, failed CHECKs in V8 APIs, or memory corruption — surfacing as "Fatal error in <file>:<line>: <message>" and process exit.
Common situations: Scripts allocating very large arrays/buffers without --max-old-space-size tuning; V8 flag misuse; bugs in native extensions; rarely, genuine V8 bugs that should be reported upstream with the backtrace.
Related errors
- Cannot access pointer: expected 'ArrayBuffer', 'SharedArrayB
- buffer must be a TypedArray or a DataView
- source must be a TypedArray or a DataView
- ReadRawBytes() failed
- v8.startupSnapshot.setDeserializeMainFunction() can only be
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/05ecf17447ed1083.
Report an issue: GitHub.