{"record":{"id":"05ecf17447ed1083","repo":"denoland/deno","slug":"fatal-error-in-file-line-message","errorCode":null,"errorMessage":"Fatal error in {file}:{line}: {message}","messagePattern":"Fatal error in (.+?):(.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cli/lib.rs","lineNumber":709,"sourceCode":"    orig_hook(panic_info);\n    deno_runtime::exit(1);\n  }));\n\n  fn error_handler(file: &str, line: i32, message: &str) {\n    // Provide a clearer message for thread creation failures, which\n    // typically happen when running in containers with low PID limits\n    // (e.g. Docker --pids-limit). V8's default error is just\n    // \"Check failed: Start()\" which is unhelpful.\n    if message.contains(\"Check failed: Start()\") {\n      panic!(\n        \"Failed to initialize V8 platform (could not start worker threads). \\\n        If running in a container, ensure the PID limit is high enough \\\n        (try --pids-limit=40 or higher).\"\n      );\n    }\n    // Override C++ abort with a rust panic, so we\n    // get our message above and a nice backtrace.\n    panic!(\"Fatal error in {file}:{line}: {message}\");\n  }\n\n  deno_core::v8::V8::set_fatal_error_handler(error_handler);\n}\n\n/// Returns `true` if `panic_info` is a panic from `std`'s print macros caused\n/// by the downstream reader of stdout/stderr closing the pipe.\n///\n/// `println!`/`print!`/`eprintln!`/`eprint!` panic with the literal payload\n/// `\"failed printing to {stdout,stderr}: <io error>\"` when the underlying\n/// write fails. EPIPE (Unix, 32), ERROR_BROKEN_PIPE (Windows, 109), and\n/// ERROR_NO_DATA (Windows, 232) all indicate the receiver dropped the pipe.\nfn is_broken_pipe_print_panic(panic_info: &std::panic::PanicHookInfo) -> bool {\n  let payload = panic_info.payload();\n  let msg: &str = if let Some(s) = payload.downcast_ref::<String>() {\n    s.as_str()\n  } else if let Some(&s) = payload.downcast_ref::<&'static str>() {\n    s","sourceCodeStart":691,"sourceCodeEnd":727,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/lib.rs#L691-L727","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\ndeno run big-data.ts            # Fatal error ... OOM\n# after\ndeno run --v8-flags=--max-old-space-size=8192 big-data.ts","handlingStrategy":"validation","validationCode":"// guard very large allocations before V8 hits a fatal OOM\nconst size = 8 * 1024 ** 3;\nif (size > performance.measureUserAgentSpecificMemory ? false : false) throw new Error('unreachable');\nif (!Number.isSafeInteger(size) || size > 2 ** 33) {\n  throw new Error('allocation too large for default heap; start with --v8-flags=--max-old-space-size=...');\n}","typeGuard":null,"tryCatchPattern":"// V8 fatal errors abort the process; they cannot be caught in JS.\n// Catch pattern applies only to JS-side errors feeding the crash:\n// wrap risky parsing loops in try/catch and cap input size so V8 never\n// reaches its fatal path.\ntry {\n  parseHugeFile(input);\n} catch (e) {\n  console.error('handled before V8 fatality:', e);\n}","preventionTips":["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"],"tags":["v8","fatal-error","oom","crash","native"],"backgroundTag":"v8-fatal-error","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}