Hmbown/CodeWhale · error
output_limit_truncated checked above
Error message
output_limit_truncated checked above
What it means
Invariant in run_turn(): whether the response was truncated by the output limit (output_limit_truncated) was decided earlier in the loop body; a later branch asserts that flag was already computed. Firing indicates control flow was reordered or a path skips the earlier check — a code bug.
Source
Thrown at crates/tui/src/core/engine/turn_loop.rs:1573
let thinking_only_no_sendable = !has_sendable_assistant_content;
// Add assistant message to session
if has_sendable_assistant_content {
self.add_session_message(Message {
role: "assistant".to_string(),
content: content_blocks,
})
.await;
}
// A truncated response with no tool call cannot continue through
// tool execution: surface the truncation as a bounded observation
// and resume the loop so the model can act on it instead of the
// turn silently ending on a cut-off answer.
if output_limit_truncated.is_some() && tool_uses.is_empty() {
let reason = output_limit_truncated
.take()
.expect("output_limit_truncated checked above");
self.add_session_message(
self.runtime_text_message_with_turn_metadata(
format!(
"[runtime] The provider stopped generation at its output limit (`{reason}`) before completing. Your last response was cut off. Continue from where you left off; do not repeat content already delivered."
),
UserInputProvenance::Runtime,
),
)
.await;
let _ = self
.tx_event
.send(Event::status(
"Continuing — provider output limit reached; asking the model to continue"
.to_string(),
))
.await;
turn.next_step();
continue;View on GitHub (pinned to 0c42157ee5)
Solutions
- Restore the earlier truncation check on every path that reaches this point
- Restructure the loop so truncation state is computed before any consumer
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/tui/src/core/engine/turn_loop.rs:1573 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/50b932b0d96b518a.
Report an issue: GitHub.