{"record":{"id":"d379bb7af83a8165","repo":"Hmbown/CodeWhale","slug":"model-stream-ended-with-no-answer-or-tool-call","errorCode":null,"errorMessage":"Model stream ended with no answer or tool call.","messagePattern":"Model stream ended with no answer or tool call\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/core/engine/turn_loop.rs","lineNumber":2610,"sourceCode":"                            \"Model reached the response output limit with no answer or tool call (requested allowance: {} tokens, including reasoning).\",\n                            stream_request.max_tokens\n                        )\n                    } else if has_provider_reasoning {\n                        let reason = codewhale_models::stop_reason_detail(stop_reason.as_deref());\n                        format!(\n                            \"Model returned reasoning but no answer or tool call; the provider response was incomplete (stop reason: {}).\",\n                            reason\n                                .chars()\n                                .flat_map(char::escape_default)\n                                .take(120)\n                                .collect::<String>()\n                        )\n                    } else if let Some(reason) = stop_reason.as_deref() {\n                        format!(\n                            \"Model returned terminal stop reason `{reason}` with no answer or tool call.\"\n                        )\n                    } else {\n                        \"Model stream ended with no answer or tool call.\".to_string()\n                    };\n                    crate::logging::warn(&message);\n                    turn_error = Some(message.clone());\n                    let _ = self\n                        .tx_event\n                        .send(Event::error(ErrorEnvelope::classify(message, true)))\n                        .await;\n                }\n\n                if turn_error.is_none() {\n                    if !turn.budget_exhausted_final_report {\n                        turn.stop_diagnostics.reason = Some(TurnStopReason::ProviderNoToolCall);\n                    }\n                    // This branch received no calls and dispatches no tools.\n                    turn.stop_diagnostics.last_response_tool_calls_suppressed = Some(0);\n                }\n                break;\n            }","sourceCodeStart":2592,"sourceCodeEnd":2628,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/core/engine/turn_loop.rs#L2592-L2628","documentation":"Same condition as its sibling error but with no stop_reason available: the model stream simply ended and no answer text or tool call was produced. The turn loop logs a warning, records a turn error, and sends a classified error event to the UI. It guards against providers returning empty streams without explanation.","triggerScenarios":"run_turn detects stream end (Ok(None)) with zero accumulated content and no tool calls, and stop_reason is None or non-string. Reached from handle_send_message.","commonSituations":"Provider outages or load-shedding returning empty 200 streams; flaky networks closing SSE connections prematurely; buggy or experimental model endpoints emitting no deltas; API version regressions in streaming format.","solutions":["Retry the send — the engine counts nothing-streamed turns and can retry; a transient provider blip is the most common cause.","Check provider status/health and network connectivity to the endpoint.","Verify the model ID and API version in configuration are valid for streaming.","Inspect session logs for preceding stream errors that may explain the empty stream."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// empty-stream failures are usually transient: retry with a small cap\nlet mut attempts = 0;\nwhile attempts < 3 {\n    match send_message(prompt).await {\n        Err(e) if e.contains(\"no answer or tool call\") => { attempts += 1; continue; }\n        r => break r,\n    }\n}","preventionTips":["Use stable, GA model endpoints rather than experimental ones for critical flows.","Keep network paths to the provider reliable; avoid flaky proxies.","Watch provider status pages and fail over during incidents."],"tags":["llm","streaming","empty-response","network"],"backgroundTag":"empty-api-response","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T21:17:16.096Z"}