Hmbown/CodeWhale · error · anyhow::Error

Antigravity cloud-code stream ended without a text part

Error message

Antigravity cloud-code stream ended without a text part

What it means

The cloud-code adapter emits MessageStart/ContentBlockDelta only after the first extractable text part; if the entire stream finishes with started == false - no frame ever yielded text - it errors with 'ended without a text part' instead of producing an empty assistant message. Non-text frames alone (usage, finish, envelope events) do not count as a text part.

Solutions

  1. Retry once - empty streams are often transient.
  2. Replay with curl and inspect the frames: if they contain parts this adapter ignores, the response is not empty but an unsupported shape - report it.
  3. Verify the model id and prompt on the cloud-code route actually produce text completions.
  4. Check safety/blocking settings on the backend account.
Defensive patterns

Strategy: retry

Try / catch

// Rust: retry once - empty completions are often transient
Err(err) if err.to_string().contains("without a text part") && attempt == 0 => {
    attempt += 1;
    continue;
}

Prevention

When it happens

Trigger: All model parts filtered server-side (safety filter, empty candidates); the response contains only tool-call or non-text parts this adapter cannot surface; the upstream returns envelope-only frames due to a request issue (bad model id, prompt) without an explicit error event.

Common situations: Safety-filtered or empty completions; model ids that return structured-only output; transient backend hiccups producing bare envelopes.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/900827775f8a10a3. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/client/cloud_code.rs:271

                        });
                        yield Ok(StreamEvent::ContentBlockStart {
                            index: 0,
                            content_block: ContentBlockStart::Text {
                                text: String::new(),
                            },
                        });
                    }
                    yield Ok(StreamEvent::ContentBlockDelta {
                        index: 0,
                        delta: Delta::TextDelta { text },
                    });
                }
            }
            if started {
                yield Ok(StreamEvent::ContentBlockStop { index: 0 });
                yield Ok(StreamEvent::MessageStop);
            } else {
                yield Err(anyhow::anyhow!(
                    "Antigravity cloud-code stream ended without a text part"
                ));
            }
        };
        Ok(Box::pin(stream))
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::models::{Message, MessageRequest, SystemBlock, SystemPrompt};

    fn text_request(model: &str, prompt: &str) -> MessageRequest {
        MessageRequest {
            model: model.to_string(),
            messages: vec![Message {
                role: "user".to_string(),

View on GitHub (pinned to 0c42157ee5)