{"record":{"id":"eca03433730946e6","repo":"denoland/deno","slug":"bootstrap-exception-error","errorCode":null,"errorMessage":"Bootstrap exception: {error}","messagePattern":"Bootstrap exception: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"runtime/worker.rs","lineNumber":851,"sourceCode":"    {\n      let op_state = self.js_runtime.op_state();\n      let mut state = op_state.borrow_mut();\n      state.put(options.clone());\n      if let Some((fd, serialization)) = options.node_ipc_init {\n        state.put(deno_node::ChildPipeFd(fd, serialization));\n      }\n    }\n\n    deno_core::scope!(scope, &mut self.js_runtime);\n    v8::tc_scope!(scope, scope);\n    let args = options.as_v8(scope);\n    let bootstrap_fn = self.bootstrap_fn_global.take().unwrap();\n    let bootstrap_fn = v8::Local::new(scope, bootstrap_fn);\n    let undefined = v8::undefined(scope);\n    bootstrap_fn.call(scope, undefined.into(), &[args]);\n    if let Some(exception) = scope.exception() {\n      let error = JsError::from_v8_exception(scope, exception);\n      panic!(\"Bootstrap exception: {error}\");\n    }\n    if let Some(t) = t0 {\n      #[allow(clippy::print_stderr, reason = \"diagnostic\")]\n      {\n        eprintln!(\n          \"[startup] {:>32}  {:?}\",\n          \"MainWorker::bootstrap (99_main)\",\n          t.elapsed()\n        );\n      }\n    }\n  }\n\n  #[cfg(not(target_os = \"linux\"))]\n  pub fn setup_memory_trim_handler(&mut self) {\n    // Noop\n  }\n","sourceCodeStart":833,"sourceCodeEnd":869,"githubUrl":"https://github.com/denoland/deno/blob/a961cdec3b1948844414ebeecc697dcad76df2d1/runtime/worker.rs#L833-L869","documentation":"After the runtime is created, MainWorker::bootstrap invokes the cached bootstrap main function (99_main.js) with the bootstrap options. If that call throws a JS exception, it is converted via JsError::from_v8_exception and re-raised as a Rust panic, because a runtime that fails bootstrap cannot serve anything.","triggerScenarios":"JS code in the bootstrap chain throwing: a startup snapshot that mismatches the Rust ops (e.g. skip_op_registration set without re-registering ops), a corrupted snapshot blob from a partial build, or embedder bootstrap options that violate invariants.","commonSituations":"Embedders building custom snapshots and workers; upgrading deno_core/deno_runtime while reusing an old snapshot; enabling skip_op_registration without supplying all ops.","solutions":["Rebuild startup snapshots after upgrading Deno crates so snapshot JS matches Rust ops","Do not set skip_op_registration unless you re-register every op the snapshot JS calls","Read the {error} text - it is the JS exception from 99_main.js (missing op, undefined function, etc.) and names the failing step","Reproduce with a minimal extension set to identify which extension's JS fails"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Embedders can isolate bootstrap failures at startup\nlet boot = std::panic::catch_unwind(AssertUnwindSafe(|| worker.bootstrap(options)));\nif boot.is_err() {\n  // snapshot/op mismatch: rebuild the snapshot before retrying, do not serve traffic\n}","preventionTips":["Regenerate startup snapshots whenever deno_core/deno_runtime versions change","Only set skip_op_registration when you re-register every op the snapshot JS references","Add a startup smoke test that boots a worker with the real snapshot in CI"],"tags":["bootstrap","worker","snapshot","extension","panic"],"backgroundTag":"runtime-bootstrap-failure","analyzedSha":"a961cdec3b1948844414ebeecc697dcad76df2d1","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}