{"record":{"id":"3f8302bf02f58e98","repo":"Hmbown/CodeWhale","slug":"auto-route-classifier-response-incomplete-provide","errorCode":null,"errorMessage":"auto-route classifier response incomplete: provider stop reason `{}`","messagePattern":"auto-route classifier response incomplete: provider stop reason `(.+?)`","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/tui/src/model_routing.rs","lineNumber":1041,"sourceCode":"                .clone()\n                .unwrap_or_else(|| \"off\".to_string()),\n        ),\n        stream: Some(false),\n        temperature: None,\n        top_p: None,\n    };\n\n    let response = if allow_response_cache {\n        tokio::time::timeout(Duration::from_secs(4), client.create_message(request)).await??\n    } else {\n        tokio::time::timeout(\n            Duration::from_secs(4),\n            client.create_message_without_response_cache(request),\n        )\n        .await??\n    };\n    if crate::models::is_incomplete_stop_reason(response.stop_reason.as_deref()) {\n        anyhow::bail!(\n            \"auto-route classifier response incomplete: provider stop reason `{}`\",\n            crate::models::stop_reason_detail(response.stop_reason.as_deref())\n        );\n    }\n    Ok(parse_inventory_auto_route_recommendation(\n        &message_response_text(&response),\n        inventory,\n    ))\n}\n\nfn inventory_auto_router_system_prompt(inventory: &ModelInventory, cost_saving: bool) -> String {\n    let mut prompt = if inventory.cross_provider_auto {\n        String::new()\n    } else {\n        // The inventory JSON below is already scoped to the active provider\n        // (#4411); say so, so the classifier does not try to name one it was\n        // never shown.\n        format!(","sourceCodeStart":1023,"sourceCodeEnd":1059,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/model_routing.rs#L1023-L1059","documentation":"The auto-route feature asks a model to classify which model should serve a request. The provider's stop_reason was flagged by is_incomplete_stop_reason() (crates/tui/src/models.rs): output-limit reasons (length/max_tokens/max_output_tokens), 'incomplete:*', content_filter, or model_context_window_exceeded. A truncated recommendation cannot be trusted, so the classifier errors; the call itself is bounded by a 4-second timeout.","triggerScenarios":"Running the auto-route classifier with a model inventory large enough that the routing recommendation exceeds the classifier model's output-token limit, or the provider ending generation early via content filtering.","commonSituations":"Huge multi-provider model lists inflating the recommendation; providers with small default output budgets; aggressive safety filters tripping on inventory text.","solutions":["Fall back to the default model selection when the classifier errors — that is the intended caller behavior","Shrink the model inventory the router considers so recommendations fit the output budget","Raise the classifier model's output token limit if your provider config allows it","Retry once; transient truncation or filter hits often pass on a second attempt"],"exampleFix":"// before: classifier failure propagates\nlet route = classify_auto_route(&inventory, req).await?;\n\n// after: fall back to the default route\nlet route = classify_auto_route(&inventory, req)\n    .await\n    .unwrap_or_else(|_| inventory.default_route());","handlingStrategy":"fallback","validationCode":null,"typeGuard":"```rust\nfn is_incomplete_classifier(err: &anyhow::Error) -> bool {\n    format!(\"{err:#}\").contains(\"auto-route classifier response incomplete\")\n}\n```","tryCatchPattern":"```rust\nlet route = match classify_auto_route(&inventory, &request).await {\n    Ok(route) => route,\n    Err(e) if is_incomplete_classifier(&e) => inventory.default_route(), // truncation carries no signal\n    Err(e) => return Err(e),\n};\n```","preventionTips":["Keep the routed model inventory small so recommendations fit the classifier's output budget","Treat classifier failures as 'use the default route', never as fatal routing errors","Prefer classifier models with generous output-token limits"],"tags":["routing","llm","provider","auto-route"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}