{"record":{"id":"bfca9020e8b67b57","repo":"Hmbown/CodeWhale","slug":"antigravity-cloud-code-request-is-missing-a-model","errorCode":null,"errorMessage":"Antigravity cloud-code request is missing a model id","messagePattern":"Antigravity cloud-code request is missing a model id","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/client/cloud_code.rs","lineNumber":89,"sourceCode":"                ContentBlock::Text { text, .. } if !text.trim().is_empty() => {\n                    parts.push(json!({ \"text\": text }));\n                }\n                ContentBlock::Text { .. } => {}\n                _ => bail!(\n                    \"Antigravity cloud-code accepts text parts only; non-text content fails closed\"\n                ),\n            }\n        }\n        if !parts.is_empty() {\n            contents.push(json!({ \"role\": role, \"parts\": parts }));\n        }\n    }\n    if contents.is_empty() {\n        bail!(\"Antigravity cloud-code request has no text contents\");\n    }\n    let model = request.model.trim();\n    if model.is_empty() {\n        bail!(\"Antigravity cloud-code request is missing a model id\");\n    }\n    Ok(json!({\n        \"model\": model,\n        \"userAgent\": \"codewhale\",\n        \"request\": {\n            \"contents\": contents,\n        }\n    }))\n}\n\n/// Pull visible text out of a cloud-code SSE JSON object. Unknown shapes\n/// return `None` so the caller can fail closed instead of guessing.\npub fn extract_cloud_code_text(value: &Value) -> Option<String> {\n    if let Some(text) = value.pointer(\"/response/candidates/0/content/parts/0/text\") {\n        return text.as_str().filter(|s| !s.is_empty()).map(str::to_string);\n    }\n    if let Some(text) = value.pointer(\"/candidates/0/content/parts/0/text\") {\n        return text.as_str().filter(|s| !s.is_empty()).map(str::to_string);","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/client/cloud_code.rs#L71-L107","documentation":"The cloud-code request builder trims `request.model` and requires a non-empty result before constructing the JSON body. An empty or whitespace model id means the wire body would carry no model, which cloud-code cannot route, so the builder fails locally. This is the last structural check before the request JSON is assembled.","triggerScenarios":"`request.model` is an empty string or only whitespace when the builder runs on an antigravity route.","commonSituations":"Provider config missing a `model` field; default-model resolution returning an empty string silently; a session created without a model after a config refactor.","solutions":["Set an explicit model id in the provider/session config for the antigravity route","Verify default-model resolution produces a non-empty id before the session starts","Fail early at session creation with a clear config error instead of at request time"],"exampleFix":"// before\nprovider.model = \"\"; // -> bail at request build time\n\n// after\nprovider.model = \"gemini-2.5-pro\";\nanyhow::ensure!(!provider.model.trim().is_empty(), \"antigravity provider needs a model id\");","handlingStrategy":"validation","validationCode":"anyhow::ensure!(\n    !request.model.trim().is_empty(),\n    \"antigravity request needs a model id; check provider config\"\n);","typeGuard":"fn model_id_present(model: &str) -> bool {\n    !model.trim().is_empty()\n}","tryCatchPattern":"match client.create_message_stream(request).await {\n    Ok(s) => Ok(s),\n    Err(err) if err.to_string().contains(\"missing a model id\") => {\n        Err(fix_config_and_restart()) // config-level fix, not a retry\n    }\n    Err(err) => Err(err),\n}","preventionTips":["Validate model ids at provider config load, not at request time","Make default-model resolution fail loudly instead of returning empty strings","Add a startup check that every configured provider has a non-empty model"],"tags":["antigravity","cloud-code","model-id","config","rust"],"backgroundTag":"missing-model-id","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}