{"record":{"id":"95a4ea9698a29098","repo":"zed-industries/zed","slug":"error-during-streamgeneratecontent-status-code","errorCode":null,"errorMessage":"error during streamGenerateContent, status code: {:?}, body: {}","messagePattern":"error during streamGenerateContent, status code: (.+?), body: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/google_ai/src/google_ai.rs","lineNumber":71,"sourceCode":"                            }\n                            match serde_json::from_str(line) {\n                                Ok(response) => Some(Ok(response)),\n                                Err(error) => Some(Err(anyhow!(format!(\n                                    \"Error parsing JSON: {error:?}\\n{line:?}\"\n                                )))),\n                            }\n                        } else {\n                            None\n                        }\n                    }\n                    Err(error) => Some(Err(anyhow!(error))),\n                }\n            })\n            .boxed())\n    } else {\n        let mut text = String::new();\n        response.body_mut().read_to_string(&mut text).await?;\n        Err(anyhow!(\n            \"error during streamGenerateContent, status code: {:?}, body: {}\",\n            response.status(),\n            text\n        ))\n    }\n}\n\npub fn validate_generate_content_request(request: &GenerateContentRequest) -> Result<()> {\n    if request.model.is_empty() {\n        bail!(\"Model must be specified\");\n    }\n\n    if request.contents.is_empty() {\n        bail!(\"Request must contain at least one content item\");\n    }\n\n    if let Some(user_content) = request\n        .contents","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/google_ai/src/google_ai.rs#L53-L89","documentation":"Raised after streamGenerateContent returns a non-success HTTP status: the error carries the status code and response body so callers can see the API's rejection reason (auth failure, quota, bad request, overload).","triggerScenarios":"Thrown at crates/google_ai/src/google_ai.rs:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the response body in the error message for the API's error explanation","Check API key validity and quota/billing status for the Google AI project","Verify the model name and request parameters are valid for streamGenerateContent","Retry with backoff if the status indicates rate limiting (429) or transient 5xx"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}