{"record":{"id":"dc6967e4064bedba","repo":"denoland/deno","slug":"uncaught-error-execution-terminated","errorCode":null,"errorMessage":"Uncaught Error: execution terminated","messagePattern":"Uncaught Error: execution terminated","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"libs/core_testing/checkin/runner/ops_worker.rs","lineNumber":159,"sourceCode":"  Ok(worker)\n}\n\nasync fn run_worker_task(\n  mut runtime: JsRuntime,\n  base_url: String,\n  main_script: String,\n  mut shutdown_rx: UnboundedReceiver<()>,\n) -> Result<(), anyhow::Error> {\n  let url = Url::try_from(base_url.as_str())?.join(&main_script)?;\n  let module = runtime.load_main_es_module(&url).await?;\n  let f = runtime.mod_evaluate(module);\n  // We need this structure for the shutdown code to ensure that the output is\n  // consistent whether the v8 termination signal is sent, or the shutdown_rx is\n  // triggered.\n  if let Err(e) = poll_fn(|cx| {\n    if shutdown_rx.poll_recv(cx).is_ready() {\n      // This matches the v8 error. We'll hit both, depending on timing.\n      return Poll::Ready(Err(anyhow!(\"Uncaught Error: execution terminated\")));\n    }\n    runtime\n      .poll_event_loop(cx, PollEventLoopOptions::default())\n      .map_err(|e| e.into())\n  })\n  .await\n  {\n    let state = runtime.op_state().clone();\n    let state = state.borrow();\n    let output: &Output = state.borrow();\n    for line in e.to_string().split('\\n') {\n      println!(\"[ERR] {line}\");\n      output.line(format!(\"[ERR] {line}\"));\n    }\n    return Ok(());\n  } else if let Err(e) = f.await {\n    let state = runtime.op_state().clone();\n    let state = state.borrow();","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/libs/core_testing/checkin/runner/ops_worker.rs#L141-L177","documentation":"This string is synthesized by the core_testing checkin runner (libs/core_testing) when its shutdown channel fires while module evaluation / the event loop is still pending. It deliberately matches V8's 'Uncaught Error: execution terminated' so output is identical whether V8 termination or graceful shutdown wins the race; it is printed as `[ERR]` lines, not a userland API error.","triggerScenarios":"Running the checkin test worker when shutdown_rx resolves before mod_evaluate/poll_event_loop complete (harness teardown, timeout), or when V8 actually terminates execution during shutdown.","commonSituations":"Deno contributors running core_testing checkin suites; a script under test that keeps the event loop alive (open server, pending timers) so shutdown races evaluation.","solutions":["Make the script under test settle its event loop before shutdown: close servers, clear timers, await pending work","If authoring checkin tests, expect the `[ERR] Uncaught Error: execution terminated` lines on both shutdown paths in the assertion","Treat repeated occurrences as a hanging workload: raise the harness timeout or fix the script"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Close servers and clear timers in the script under test so the event loop drains before shutdown","When asserting on checkin runner output, accept the [ERR] Uncaught Error: execution terminated lines on both shutdown paths","Treat persistent termination messages as a hanging workload: raise the harness timeout or fix the script"],"tags":["testing","shutdown","v8","termination","internal"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}