You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was constantly plagued with the problem from clauded code stating that
API Error: Server error mid-response. The response above may be incomplete
I discussed with grok, back end forth (fixing, trying), and spotted the root cause is an SSE event that may seem valid to grok but invalid to claude-code-proxy (like "event: { ... }" instead of "data: { ... }").
After vibe coding the steps to fix this are as follows, and all my problems with claude code are gone:
Do NOT enable http2_keep_alive_interval / http2_keep_alive_timeout (they abort during silent Grok reasoning).
In src/providers/grok/translate/stream.rs SseDecoder/parse_frame:
Comment-only and id-only SSE frames must be ignored (Ok(None)), NOT "Grok SSE frame lacks data" errors.
Optional but recommended in src/providers/grok/mod.rs stream loop:
While waiting on upstream, every ~5s emit SSE comment ": keepalive\n\n" to Claude so client idle (~15s) doesn't abort.
Log mid-stream failures (malformed_sse etc.) even when HTTP status is already 200.
cargo test (at least providers::grok), cargo build --release, install binary somewhere early on PATH, restart claude-code-proxy serve.
Verify: long high-effort multi-tool Grok session completes without mid-response; proxy.log should not show grok_stream_failed/malformed_sse on normal turns.
Would someone help make an equivalent fix in rust (I am only a beginner level Rustacean and don't want to pollute the codebase)?
I was constantly plagued with the problem from clauded code stating that
I discussed with grok, back end forth (fixing, trying), and spotted the root cause is an SSE event that may seem valid to grok but invalid to claude-code-proxy (like "event: { ... }" instead of "data: { ... }").
After vibe coding the steps to fix this are as follows, and all my problems with claude code are gone:
claude-code-proxy serve.Would someone help make an equivalent fix in rust (I am only a beginner level Rustacean and don't want to pollute the codebase)?
Thanks alot.