denoland/deno · critical · AnyError

REPL thread failed to start

Error message

REPL thread failed to start

What it means

The Jupyter kernel hosts its REPL runtime on a dedicated OS thread and signals readiness by sending the V8 isolate handle over a channel that the main thread awaits. This error means the channel closed without a send — the REPL thread panicked or exited before ReplSession::initialize() completed (worker creation, setup_repl, script execution, or session init failed inside the thread). The real panic reason is printed by the failing thread, not embedded in this message.

Solutions

  1. Run `deno jupyter` directly in a terminal and read the panic the failing thread prints — it names the actual cause
  2. Check resource limits in the failing environment (`ulimit -u`, `ulimit -v`, container memory caps) and raise them if thread/runtime creation is denied
  3. Remove custom v8 flags (DENO_V8_FLAGS / --v8-flags) and retry with defaults
  4. Reinstall or upgrade Deno to rule out a corrupted binary or an already-fixed regression
Defensive patterns

Strategy: try-catch

Try / catch

// when launching the kernel from your own tooling, treat early exit as the signal
const proc = new Deno.Command(DENO_EXE, { args: ['jupyter'], stderr: 'inherit' }).spawn();
const status = await proc.status;
if (!status.success) {
  // the REPL-thread panic is printed to stderr; surface it instead of retrying blind
  throw new Error(`kernel exited early (code ${status.code}); see stderr for the panic`);
}

Prevention

When it happens

Trigger: Starting a Jupyter kernel (`deno jupyter` / connecting a notebook to an installed kernel) when the spawned REPL thread dies early: v8/runtime initialization failure, invalid --v8-flags or DENO_V8_FLAGS, resource limits preventing thread or isolate creation (ulimit, container memory caps), or a corrupted/incompatible deno binary.

Common situations: Containers or CI with strict thread/memory limits; custom v8 flags that crash at startup; libc mismatch after a system upgrade; corrupted Deno installs; regressions in cutting-edge builds.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/60cfa1bb6651ea53. Report an issue: GitHub.

Appendix: source

Thrown at cli/tools/jupyter/mod.rs:188

        .thread_safe_handle();
      let _ = isolate_handle_tx.send(handle);

      // Service REPL requests until channel closes.
      let mut session = JupyterReplSession {
        repl_session,
        rx: repl_req_rx,
      };
      session.start().await;

      Ok::<(), AnyError>(())
    };
    deno_runtime::tokio_util::create_and_run_current_thread(fut)
  });

  // Wait for the REPL to be ready.
  let isolate_handle = isolate_handle_rx
    .await
    .map_err(|_| anyhow!("REPL thread failed to start"))?;

  // --- Create the ZMQ kernel worker on the main thread ---------------
  let kernel_main_module = resolve_url_or_path(
    "./$deno$jupyter_kernel.mts",
    cli_options.initial_cwd(),
  )
  .unwrap();

  let (worker2, _) = create_single_test_event_channel();
  let TestEventWorkerSender {
    sender: _test_sender2,
    stdout: stdout2,
    stderr: stderr2,
  } = worker2;

  let cwd_url =
    Url::from_directory_path(cli_options.initial_cwd()).map_err(|_| {
      anyhow!(

View on GitHub (pinned to 9ad36f7a2c)