{"record":{"id":"d719eb53dac45dd7","repo":"cloudflare/quiche","slug":"expected-stream-send-on-stream-to-fail-with","errorCode":null,"errorMessage":"Expected stream_send on stream {} to fail with {:?}, but wrote {} bytes","messagePattern":"Expected stream_send on stream (.+?) to fail with (.+?), but wrote (.+?) bytes","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"h3i/src/client/mod.rs","lineNumber":137,"sourceCode":"                )\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        },\n    }\n}\n\npub(crate) fn execute_action<F: quiche::BufFactory>(\n    action: &Action, conn: &mut quiche::Connection<F>,\n    stream_parsers: &mut StreamParserMap,\n) {\n    match action {","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/cloudflare/quiche/blob/9f96daa2c22a4468b0036fb0a0a3894eee6498b8/h3i/src/client/mod.rs#L119-L155","documentation":"h3i panics when a script expected stream_send to fail with a specific error, but the write unexpectedly succeeded and produced bytes. The stream was actually writable, so the preconditions the script assumed (closed stream, exhausted flow control) did not hold. This is a negative-test assertion failure in the h3i harness.","triggerScenarios":"ExecuteAction with ExpectedStreamSendResult::Error(e) where quiche stream_send returns Ok(written) on the given stream_id.","commonSituations":"Assuming a stream was reset or flow-control-blocked when the peer had already granted capacity; quiche version changes altering error behavior; wrong stream_id targeted so the failing stream was never touched.","solutions":["Verify the stream's actual state (is it closed/reset/over flow-control limit?) and correct the stream_id in the script.","If the send should legitimately succeed, change the expectation to an OkExact/OkAny variant.","Check peer settings (MAX_STREAM_DATA, initial limits) that may allow the write; tighten the scenario setup to actually block the stream."],"exampleFix":"// before\nExpectedStreamSendResult::Error(quiche::h3::Error::StreamStopped),\n// after\nExpectedStreamSendResult::OkAny,","handlingStrategy":"validation","validationCode":"// confirm the failure precondition actually holds\ndebug_assert!(!conn.stream_writable(stream_id, needed).unwrap_or(true));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify stream state (closed, reset, flow-controlled) before writing negative tests.","Target the correct stream_id in the script."],"tags":["h3i","stream-send","negative-test","assertion"],"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"}