denoland/deno · warning

Uncaught Error: execution terminated

Error message

Uncaught Error: execution terminated

What it means

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.

Source

Thrown at libs/core_testing/checkin/runner/ops_worker.rs:159

  Ok(worker)
}

async fn run_worker_task(
  mut runtime: JsRuntime,
  base_url: String,
  main_script: String,
  mut shutdown_rx: UnboundedReceiver<()>,
) -> Result<(), anyhow::Error> {
  let url = Url::try_from(base_url.as_str())?.join(&main_script)?;
  let module = runtime.load_main_es_module(&url).await?;
  let f = runtime.mod_evaluate(module);
  // We need this structure for the shutdown code to ensure that the output is
  // consistent whether the v8 termination signal is sent, or the shutdown_rx is
  // triggered.
  if let Err(e) = poll_fn(|cx| {
    if shutdown_rx.poll_recv(cx).is_ready() {
      // This matches the v8 error. We'll hit both, depending on timing.
      return Poll::Ready(Err(anyhow!("Uncaught Error: execution terminated")));
    }
    runtime
      .poll_event_loop(cx, PollEventLoopOptions::default())
      .map_err(|e| e.into())
  })
  .await
  {
    let state = runtime.op_state().clone();
    let state = state.borrow();
    let output: &Output = state.borrow();
    for line in e.to_string().split('\n') {
      println!("[ERR] {line}");
      output.line(format!("[ERR] {line}"));
    }
    return Ok(());
  } else if let Err(e) = f.await {
    let state = runtime.op_state().clone();
    let state = state.borrow();

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Make the script under test settle its event loop before shutdown: close servers, clear timers, await pending work
  2. If authoring checkin tests, expect the `[ERR] Uncaught Error: execution terminated` lines on both shutdown paths in the assertion
  3. Treat repeated occurrences as a hanging workload: raise the harness timeout or fix the script
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/dc6967e4064bedba. Report an issue: GitHub.