Hmbown/CodeWhale · error

Model response incomplete: provider stop reason `{}`; the pa

Error message

Model response incomplete: provider stop reason `{}`; the partial response was printed but the command did not succeed.

What it means

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.

Source

Thrown at crates/tui/src/lib.rs:10024

        metadata: None,
        thinking: None,
        reasoning_effort,
        stream: Some(false),
        temperature: None,
        top_p: None,
    };

    let response = client.create_message(request).await?;
    let stop_reason = response.stop_reason.clone();

    for block in response.content {
        if let ContentBlock::Text { text, .. } = block {
            println!("{text}");
        }
    }

    if is_incomplete_stop_reason(stop_reason.as_deref()) {
        anyhow::bail!(
            "Model response incomplete: provider stop reason `{}`; the partial response was printed but the command did not succeed.",
            stop_reason_detail(stop_reason.as_deref())
        );
    }

    Ok(())
}

async fn run_one_shot_json(
    config: &Config,
    model: &str,
    prompt: &str,
    force_configured_route: bool,
) -> Result<()> {
    use crate::client::DeepSeekClient;
    use crate::models::{
        ContentBlock, Message, MessageRequest, SystemPrompt, is_incomplete_stop_reason,
        stop_reason_detail,

View on GitHub (pinned to 8880682c63)

Solutions

  1. Raise the model's max output token limit in the model/config settings and rerun
  2. Shrink the prompt or split the task into smaller one-shot calls
  3. Switch to a model or variant with a larger context window when the reason is model_context_window_exceeded
  4. If the reason is content_filter, rephrase the prompt or adjust account/provider filter policy; retrying unchanged will not help

Example fix

// before: truncated at the configured output limit
let request = request.with_max_output_tokens(1024);
// after: budget sized to the task
let request = request.with_max_output_tokens(8192);
Defensive patterns

Strategy: retry

Type guard

// Stop reasons that make a printed answer untrustworthy; check before consuming output
fn is_incomplete(reason: Option<&str>) -> bool {
    let lim = |r: &str| matches!(r, "length" | "max_tokens" | "max_output_tokens");
    reason.is_some_and(|r| {
        let r = r.trim().to_ascii_lowercase();
        lim(r.as_str())
            || r.starts_with("incomplete:")
            || matches!(r.as_str(), "content_filter" | "model_context_window_exceeded")
    })
}

Try / catch

# In scripts: honor the exit code, retry once with a higher output budget
if ! codewhale exec "$prompt"; then
  echo "response incomplete; retrying with a larger output budget" >&2
  codewhale exec --max-output-tokens 8192 "$prompt"
fi

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/f0ee260c83465f9e. Report an issue: GitHub.