{"record":{"id":"e424ac2863b7974a","repo":"denoland/deno","slug":"js-panic","errorCode":null,"errorMessage":"JS PANIC: {}","messagePattern":"JS PANIC: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"libs/core/ops_builtin.rs","lineNumber":155,"sourceCode":"  ops_builtin_v8::op_op_names,\n  ops_builtin_v8::op_current_user_call_site,\n  ops_builtin_v8::op_set_format_exception_callback,\n  ops_builtin_v8::op_event_loop_has_more_work,\n  ops_builtin_v8::op_immediate_check,\n  ops_builtin_v8::op_leak_tracing_enable,\n  ops_builtin_v8::op_leak_tracing_submit,\n  ops_builtin_v8::op_leak_tracing_get_all,\n  ops_builtin_v8::op_leak_tracing_get,\n  ops_builtin_v8::op_get_ext_import_meta_proto\n}\n\n#[op2(fast)]\npub fn op_panic(#[string] message: String) {\n  #[allow(clippy::print_stderr, reason = \"intentional panic output\")]\n  {\n    eprintln!(\"JS PANIC: {}\", message);\n  }\n  panic!(\"JS PANIC: {}\", message);\n}\n\n/// Return map of resources with id as key\n/// and string representation as value.\n#[op2]\npub fn op_resources(state: &mut OpState) -> Vec<(ResourceId, String)> {\n  state\n    .resource_table\n    .names()\n    .map(|(rid, name)| (rid, name.to_string()))\n    .collect()\n}\n\n#[op2(fast)]\nfn op_add(a: i32, b: i32) -> i32 {\n  a + b\n}\n","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/libs/core/ops_builtin.rs#L137-L173","documentation":"op_panic is deno_core's escape hatch for JS runtime internals: when internal bootstrap/extension JS reaches an impossible state, it calls this op, which prints `JS PANIC: <message>` to stderr and panics the runtime, taking down the process. The message names the internal invariant that failed. It is unrelated to user exceptions — uncaught user errors go through the normal error path.","triggerScenarios":"Internal Deno JS code (runtime bootstrap, core extensions) signaling an unreachable state, or embedder/extension code deliberately calling Deno.core.ops.op_panic. The panic is process-fatal and cannot be caught from JS.","commonSituations":"Mismatched runtime pieces after a partial Deno upgrade or corrupted install (binary vs snapshot vs JS); snapshots built from a different deno_core version; genuine bugs in Deno internals on unusual code paths.","solutions":["Reinstall/update Deno so the binary, snapshot, and JS runtime all come from the same version","Read the message — it names the failing invariant, which maps to a specific runtime subsystem","If your own code reaches for core.ops.op_panic, throw a normal Error instead","Report with the exact JS PANIC message and a reproducer when it comes from Deno internals"],"exampleFix":"// before — extension code invokes the internal panic op\nDeno.core.ops.op_panic(\"unreachable branch\");\n\n// after — throw a catchable JS error\nthrow new Error(\"unreachable branch\");","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the Deno binary, snapshot, and JS runtime from the same version — reinstall cleanly on upgrade mismatches","Never call Deno.core.ops.op_panic from your own code; throw a normal Error","Capture the exact JS PANIC message when reporting — it names the broken invariant"],"tags":["deno-core","runtime","internal","assert","panic"],"backgroundTag":"runtime-internal-assertion-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}