Hmbown/CodeWhale · error

REPL kernel stays alive during a round

Error message

REPL kernel stays alive during a round

What it means

During a REPL round the kernel is expected to remain alive for the whole block loop; the assertion that the kernel is still present mid-round guards against code that could drop or replace it between blocks. Firing means something released the kernel mid-round — an internal invariant violation.

Source

Thrown at crates/tui/src/core/engine/turn_loop.rs:1725

                    let repl_started = Instant::now();

                    let mut final_result: Option<String> = None;
                    let mut kernel_failed = false;
                    let mut empty_cap_hit = false;
                    for (i, block) in repl_blocks.iter().enumerate() {
                        let round_num = i + 1;
                        let _ = self
                            .tx_event
                            .send(Event::status(format!(
                                "REPL round {round_num}: executing..."
                            )))
                            .await;

                        let round_result = match bridge.as_ref() {
                            Some(bridge) => {
                                self.repl_kernel
                                    .as_mut()
                                    .expect("REPL kernel stays alive during a round")
                                    .run(&block.code, Some(bridge))
                                    .await
                            }
                            None => {
                                self.repl_kernel
                                    .as_mut()
                                    .expect("REPL kernel stays alive during a round")
                                    .execute(&block.code)
                                    .await
                            }
                        };

                        match round_result {
                            Ok(round) => {
                                if let Some(val) = &round.final_value {
                                    let _ = self
                                        .tx_event
                                        .send(Event::status(format!(

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Find code that clears/replaces repl_kernel during a round and move it to round boundaries
  2. Keep the kernel owned for the duration of the round scope
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/tui/src/core/engine/turn_loop.rs:1725 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/4acdede64843f86f. Report an issue: GitHub.