{"record":{"id":"f0ee260c83465f9e","repo":"Hmbown/CodeWhale","slug":"model-response-incomplete-provider-stop-reason","errorCode":null,"errorMessage":"Model response incomplete: provider stop reason `{}`; the partial response was printed but the command did not succeed.","messagePattern":"Model response incomplete: provider stop reason `(.+?)`; the partial response was printed but the command did not succeed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":10024,"sourceCode":"        metadata: None,\n        thinking: None,\n        reasoning_effort,\n        stream: Some(false),\n        temperature: None,\n        top_p: None,\n    };\n\n    let response = client.create_message(request).await?;\n    let stop_reason = response.stop_reason.clone();\n\n    for block in response.content {\n        if let ContentBlock::Text { text, .. } = block {\n            println!(\"{text}\");\n        }\n    }\n\n    if is_incomplete_stop_reason(stop_reason.as_deref()) {\n        anyhow::bail!(\n            \"Model response incomplete: provider stop reason `{}`; the partial response was printed but the command did not succeed.\",\n            stop_reason_detail(stop_reason.as_deref())\n        );\n    }\n\n    Ok(())\n}\n\nasync fn run_one_shot_json(\n    config: &Config,\n    model: &str,\n    prompt: &str,\n    force_configured_route: bool,\n) -> Result<()> {\n    use crate::client::DeepSeekClient;\n    use crate::models::{\n        ContentBlock, Message, MessageRequest, SystemPrompt, is_incomplete_stop_reason,\n        stop_reason_detail,","sourceCodeStart":10006,"sourceCodeEnd":10042,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/lib.rs#L10006-L10042","documentation":"After a one-shot (non-interactive) model call prints the response text, the command bails when the provider's stop reason marks the answer incomplete: output-limit reasons (length, max_tokens, max_output_tokens), content_filter, model_context_window_exceeded, or any Responses-API reason prefixed 'incomplete:'. The partial text is already on stdout; the non-zero exit prevents scripts from mistaking truncation for success.","triggerScenarios":"One-shot invocations whose max output token limit is smaller than the answer, prompts plus history exceeding the model context window, provider content filters aborting generation, or Responses API returning an 'incomplete:...' status.","commonSituations":"Long code generation with a low default output budget, pasting large files into the prompt, policy-restricted accounts hitting filters, provider incidents surfacing as incomplete statuses.","solutions":["Raise the model's max output token limit in the model/config settings and rerun","Shrink the prompt or split the task into smaller one-shot calls","Switch to a model or variant with a larger context window when the reason is model_context_window_exceeded","If the reason is content_filter, rephrase the prompt or adjust account/provider filter policy; retrying unchanged will not help"],"exampleFix":"// before: truncated at the configured output limit\nlet request = request.with_max_output_tokens(1024);\n// after: budget sized to the task\nlet request = request.with_max_output_tokens(8192);","handlingStrategy":"retry","validationCode":null,"typeGuard":"// Stop reasons that make a printed answer untrustworthy; check before consuming output\nfn is_incomplete(reason: Option<&str>) -> bool {\n    let lim = |r: &str| matches!(r, \"length\" | \"max_tokens\" | \"max_output_tokens\");\n    reason.is_some_and(|r| {\n        let r = r.trim().to_ascii_lowercase();\n        lim(r.as_str())\n            || r.starts_with(\"incomplete:\")\n            || matches!(r.as_str(), \"content_filter\" | \"model_context_window_exceeded\")\n    })\n}","tryCatchPattern":"# In scripts: honor the exit code, retry once with a higher output budget\nif ! codewhale exec \"$prompt\"; then\n  echo \"response incomplete; retrying with a larger output budget\" >&2\n  codewhale exec --max-output-tokens 8192 \"$prompt\"\nfi","preventionTips":["Set output token budgets sized to the task before generation-heavy one-shots","Keep prompts inside the model context budget; summarize long inputs","Check exit codes, not just stdout presence, in automation","Route content_filter stops to prompt review, never blind retries"],"tags":["llm","provider","stop-reason","one-shot","truncation"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}