nikivdev/code · error
Gemini returned empty handoff
Error message
Gemini returned empty handoff
What it means
Error "Gemini returned empty handoff" thrown in nikivdev/code.
Source
Thrown at src/ai.rs:14717
.context("failed to call Gemini API")?;
if !resp.status().is_success() {
let status = resp.status();
let text = resp.text().unwrap_or_default();
bail!("Gemini API error {}: {}", status, text);
}
let parsed: GeminiResponse = resp.json().context("failed to parse Gemini response")?;
let content = parsed
.candidates
.get(0)
.and_then(|c| c.content.parts.get(0))
.and_then(|p| p.text.as_deref())
.unwrap_or("")
.trim();
if content.is_empty() {
bail!("Gemini returned empty handoff");
}
Ok(content.to_string())
}
fn parse_summary_response(content: &str) -> Result<SessionSummaryResponse> {
if let Ok(parsed) = serde_json::from_str::<SessionSummaryResponse>(content) {
return Ok(parsed);
}
let json_blob = extract_json_object(content)
.ok_or_else(|| anyhow::anyhow!("summary response was not valid JSON"))?;
serde_json::from_str(&json_blob).context("failed to parse summary JSON")
}
fn extract_json_object(s: &str) -> Option<String> {
let start = s.find('{')?;
let end = s.rfind('}')?;View on GitHub (pinned to a747e741ae)
When it happens
Trigger: Thrown at src/ai.rs:14717 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/01e1938af611d722.
Report an issue: GitHub.