{"record":{"id":"18e292af414f1813","repo":"denoland/deno","slug":"repl-thread-error","errorCode":null,"errorMessage":"REPL thread error: {}","messagePattern":"REPL thread error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/jupyter/mod.rs","lineNumber":259,"sourceCode":"    });\n    op_state.put(KernelIsolateHandle {\n      handle: isolate_handle,\n    });\n    op_state.put(KernelConnectionInfo { json: conn_file });\n  }\n\n  // Bootstrap the JS ZMQ kernel then run the event loop.\n  kernel_worker.execute_script_static(\n    located_script_name!(),\n    \"Deno[Deno.internal].startJupyterKernel();\",\n  )?;\n  let mut kernel_main = kernel_worker.into_main_worker();\n  kernel_main.run_event_loop(false).await?;\n\n  // Wait for the REPL thread to finish.\n  match repl_thread.join() {\n    Ok(Ok(())) => {}\n    Ok(Err(e)) => bail!(\"REPL thread error: {}\", e),\n    Err(_) => bail!(\"REPL thread panicked\"),\n  }\n\n  Ok(())\n}\n\n// ------------------------------------------------------------------\n// REPL session wrapper running on the background thread\n// ------------------------------------------------------------------\n\nstruct JupyterReplSession {\n  repl_session: repl::ReplSession,\n  rx: mpsc::UnboundedReceiver<JupyterReplRequest>,\n}\n\nimpl JupyterReplSession {\n  async fn start(&mut self) {\n    let mut poll_worker = true;","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/jupyter/mod.rs#L241-L277","documentation":"The Jupyter kernel runs a REPL session on a background OS thread while the main worker serves ZMQ. When that thread finishes by returning Err (any error escaping the REPL session — evaluation infrastructure failure, stdio problem, initialization error), the main thread joins it and re-raises the inner error with this 'REPL thread error' prefix.","triggerScenarios":"The REPL session thread exits via Err: failures in ReplSession setup, a crashed eval loop, or an I/O error on the thread's channels. The kernel's event loop ran (run_event_loop completed), then repl_thread.join() returned Ok(Err(e)).","commonSituations":"Notebook sessions dying mid-use; Deno/Jupyter version mismatches after an upgrade; resource exhaustion in long-running kernels.","solutions":["Restart the Jupyter kernel (Kernel -> Restart) — most REPL-thread failures are one-off","Update Deno to the latest patch release (jupyter integration fixes land regularly)","If it reproduces, capture the inner error text after 'REPL thread error:' and report it at github.com/denoland/deno/issues with the notebook cell that triggered it"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"Treat kernel death ('REPL thread error: ...') in clients as session-level failure: restart the kernel process and re-execute the notebook; surface the inner error text to the user for diagnosis.","preventionTips":["Keep notebooks' kernel sessions short; restart kernels periodically on long sessions","Update Deno and jupyter-related packages together","Save notebooks often — kernel thread errors end the session"],"tags":["jupyter","repl","thread","kernel","concurrency"],"backgroundTag":"background-thread-exception","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"}