zed-industries/zed · error

error during streamGenerateContent, status code: {:?}, body:

Error message

error during streamGenerateContent, status code: {:?}, body: {}

What it means

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).

Source

Thrown at crates/google_ai/src/google_ai.rs:71

                            }
                            match serde_json::from_str(line) {
                                Ok(response) => Some(Ok(response)),
                                Err(error) => Some(Err(anyhow!(format!(
                                    "Error parsing JSON: {error:?}\n{line:?}"
                                )))),
                            }
                        } else {
                            None
                        }
                    }
                    Err(error) => Some(Err(anyhow!(error))),
                }
            })
            .boxed())
    } else {
        let mut text = String::new();
        response.body_mut().read_to_string(&mut text).await?;
        Err(anyhow!(
            "error during streamGenerateContent, status code: {:?}, body: {}",
            response.status(),
            text
        ))
    }
}

pub fn validate_generate_content_request(request: &GenerateContentRequest) -> Result<()> {
    if request.model.is_empty() {
        bail!("Model must be specified");
    }

    if request.contents.is_empty() {
        bail!("Request must contain at least one content item");
    }

    if let Some(user_content) = request
        .contents

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Inspect the response body in the error message for the API's error explanation
  2. Check API key validity and quota/billing status for the Google AI project
  3. Verify the model name and request parameters are valid for streamGenerateContent
  4. Retry with backoff if the status indicates rate limiting (429) or transient 5xx
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/google_ai/src/google_ai.rs:71 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20). Data as JSON: /api/errors/95a4ea9698a29098. Report an issue: GitHub.