{"record":{"id":"2e30c097cbdf64e7","repo":"Hmbown/CodeWhale","slug":"runtime-sse-frame-exceeded-max-sse-frame-bytes-b","errorCode":null,"errorMessage":"runtime SSE frame exceeded {MAX_SSE_FRAME_BYTES} bytes without a frame delimiter","messagePattern":"runtime SSE frame exceeded (.+?) bytes without a frame delimiter","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/app-server/src/lib.rs","lineNumber":1923,"sourceCode":"        since_seq: u64,\n        mut transcript: Option<&mut TurnTranscript>,\n    ) -> Result<(u64, TurnTerminalStatus, Option<String>)> {\n        let mut response = self\n            .authed(self.client.get(format!(\n                \"{}/v1/threads/{thread_id}/events?since_seq={since_seq}\",\n                self.base_url\n            )))\n            .send()\n            .await?\n            .error_for_status()?;\n\n        let mut buffer = Vec::new();\n        let mut last_seq = since_seq;\n\n        while let Some(chunk) = response.chunk().await? {\n            buffer.extend_from_slice(&chunk);\n            if buffer.len() > MAX_SSE_FRAME_BYTES {\n                bail!(\n                    \"runtime SSE frame exceeded {MAX_SSE_FRAME_BYTES} bytes without a frame delimiter\"\n                );\n            }\n            while let Some(frame_bytes) = take_sse_frame(&mut buffer) {\n                let Some((event_name, frame_data)) = parse_sse_frame(&frame_bytes) else {\n                    continue;\n                };\n                let envelope: Value = serde_json::from_str(&frame_data)\n                    .with_context(|| format!(\"invalid SSE json for {event_name}: {frame_data}\"))?;\n                if let Some(seq) = envelope.get(\"seq\").and_then(Value::as_u64) {\n                    last_seq = last_seq.max(seq);\n                }\n                if envelope.get(\"turn_id\").and_then(Value::as_str) != Some(turn_id) {\n                    continue;\n                }\n                let payload = envelope.get(\"payload\").cloned().unwrap_or(Value::Null);\n                match event_name.as_str() {\n                    \"item.delta\" => {","sourceCodeStart":1905,"sourceCodeEnd":1941,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/app-server/src/lib.rs#L1905-L1941","documentation":"The app-server client reads a runtime SSE (Server-Sent Events) stream and accumulates chunks in a buffer. If the buffer grows past MAX_SSE_FRAME_BYTES without a complete frame delimiter appearing, this error is thrown to bound memory use, since a valid SSE frame can never legitimately be that large.","triggerScenarios":"Any call that consumes the runtime's SSE event stream (polling run events via HTTP chunked response) where a single event frame exceeds the configured byte limit before a newline/frame delimiter arrives.","commonSituations":"A malicious or broken runtime/server streaming a huge un-delimited body; a proxy mangling SSE framing so newlines are lost; a misconfigured runtime emitting extremely large payloads as one event.","solutions":["Inspect what the runtime is actually streaming (curl the SSE endpoint) to find the oversized frame's origin.","Check for proxies/load balancers between client and runtime that strip SSE newlines or re-chunk the body.","Verify the runtime version matches what the client expects; upgrade or downgrade so framing is standard SSE.","If a legitimate event is too large, reduce the event payload size on the runtime side instead of raising the limit."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust\nmatch client.poll_events(...) {\n    Err(e) if e.to_string().contains(\"SSE frame exceeded\") => {\n        log::error!(\"runtime streamed an oversized frame; check proxies/runtime version\");\n        // fail the turn rather than retrying blindly\n    }\n    other => other,\n}","preventionTips":["Do not place newline-stripping proxies between client and runtime.","Keep runtime and client versions aligned so SSE framing is standard.","Keep individual event payloads small on the runtime side."],"tags":["sse","streaming","network","protocol"],"backgroundTag":"payload-too-large","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}