{"record":{"id":"fba8750996cbeed6","repo":"cloudflare/quiche","slug":"expected-stream-send-on-stream-to-write-byte-fba875","errorCode":null,"errorMessage":"Expected stream_send on stream {} to write {} bytes, got error: {:?}","messagePattern":"Expected stream_send on stream (.+?) to write (.+?) bytes, got error: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"h3i/src/client/mod.rs","lineNumber":129,"sourceCode":"    stream_id: u64,\n) {\n    match expected {\n        ExpectedStreamSendResult::Ok => {\n            result.unwrap_or_else(|err| {\n                panic!(\n                    \"Expected stream_send on stream {} to succeed, but got: {:?}\",\n                    stream_id, err\n                )\n            });\n        },\n        ExpectedStreamSendResult::OkExact(expected_bytes) => {\n            match result {\n                Ok(actual_bytes) if actual_bytes == *expected_bytes => {},\n                Ok(actual_bytes) => panic!(\n                    \"Expected stream_send on stream {} to write {} bytes, got {}\",\n                    stream_id, expected_bytes, actual_bytes\n                ),\n                Err(err) => panic!(\n                    \"Expected stream_send on stream {} to write {} bytes, got error: {:?}\",\n                    stream_id, expected_bytes, err\n                ),\n            }\n        },\n        ExpectedStreamSendResult::Error(expected_err) => {\n            match result {\n                Ok(written) => panic!(\n                    \"Expected stream_send on stream {} to fail with {:?}, but wrote {} bytes\",\n                    stream_id, expected_err, written\n                ),\n                Err(actual_err) if &actual_err == expected_err => {},\n                Err(actual_err) => panic!(\n                    \"Expected stream_send on stream {} to fail with {:?}, got {:?}\",\n                    stream_id, expected_err, actual_err\n                ),\n            }\n        },","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/cloudflare/quiche/blob/9f96daa2c22a4468b0036fb0a0a3894eee6498b8/h3i/src/client/mod.rs#L111-L147","documentation":"h3i's stream_send validation panics when the script expected an exact byte count but quiche's stream_send returned an error instead of writing bytes. This means the stream could not accept data at all — commonly because it was closed, reset, or the connection is in an error/drain state. It is an assertion failure inside the h3i test driver.","triggerScenarios":"ExecuteAction with ExpectedStreamSendResult::OkExact(n) where quiche stream_send returns Err (e.g. StreamStopped, FlowControl, Done on a closed stream).","commonSituations":"Sending on a stream the peer already reset; writing after the connection hit an error; script ordering issues where a close/reset frame action runs before the send.","solutions":["Inspect the debug-printed error to identify which stream/connection state failed, and fix the script ordering so the send precedes any close/reset.","If an error is legitimate, change the expectation to ExpectedStreamSendResult::Error(expected_err).","Verify the stream_id exists and was created by an earlier action (headers/data frame) in the script."],"exampleFix":"// before\nExpectedStreamSendResult::OkExact(512),\n// after\nExpectedStreamSendResult::Error(quiche::h3::Error::StreamStopped),","handlingStrategy":"validation","validationCode":"// ensure the stream is still open before asserting a successful send\nif !conn.stream_writable(stream_id, 1).unwrap_or(false) {\n    // adjust expectation to an Error variant or skip the action\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Order script actions so sends happen before close/reset actions.","Match expectations against the actual quiche error variants returned by your quiche version."],"tags":["h3i","stream-send","assertion","http3"],"backgroundTag":"invalid-state-transition","analyzedSha":"9f96daa2c22a4468b0036fb0a0a3894eee6498b8","analyzedAt":"2026-09-08T11:27:09.536Z","contentChangedAt":"2026-09-08T11:27:09.536Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}