-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Anthropic SSE stream parser fails with providers that omit space after data: prefix #7928
Copy link
Copy link
Closed
Description
Summary
Goose's Anthropic SSE stream parser requires data: (with a trailing space) before JSON payloads, but the SSE specification treats the space as optional. Providers that send data:{"type":...} instead of data: {"type":...} are silently ignored, resulting in "Stream yielded no message" and an empty session.
Affected providers
- Kimi Code (
api.kimi.com/coding) — Anthropic-compatible endpoint sendsdata:without space. This is the provider that exposed the issue. - Potentially any third-party Anthropic-compatible provider.
Steps to reproduce
- Configure a custom Anthropic-compatible provider pointing to Kimi's API:
{ "name": "kimi", "engine": "anthropic", "base_url": "https://api.kimi.com/coding", "models": [{"name": "kimi-for-coding", "context_limit": 262144}], "supports_streaming": true, "requires_auth": true } - Run
goose run --text "Hello" --no-session - Goose connects, receives a valid 200 response with SSE events, but displays no output.
Root cause
In crates/goose/src/providers/formats/anthropic.rs line 575:
if line.trim().is_empty() || !line.starts_with("data: ") {
continue;
}This skips all lines that start with data: but not data: . The same issue exists in the OpenAI, OpenAI Responses, and Snowflake format parsers.
Expected behavior
Both data: {...} and data:{...} should be parsed, per the SSE spec.
Debug log
WARN: "🔍 Anthropic no final usage to yield"
WARN: "Failed to generate session description: Execution error: Stream yielded no message"
Environment
- Goose 1.27.2
- macOS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels