cloudflare/quiche · error

Expected stream_send on stream

Error message

Expected stream_send on stream {} to fail with {:?}, got {:?}

What it means

h3i panics when a script expected stream_send to fail with one specific error but a different error was returned. The stream did fail, just not with the anticipated quiche::h3::Error variant, so the negative assertion is too narrow. This is a test-expectation mismatch, typically after protocol or quiche version changes.

Solutions

  1. Read the actual error in the panic message and update the expected error to match reality if the new behavior is correct.
  2. Loosen the assertion logic in your harness if any error variant is acceptable for this scenario.
  3. Confirm which quiche version the script targets and pin it, or migrate expected variants to the new enum values.

Example fix

// before
ExpectedStreamSendResult::Error(quiche::h3::Error::StreamStopped),
// after
ExpectedStreamSendResult::Error(quiche::h3::Error::FlowControl),
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: ExecuteAction with ExpectedStreamSendResult::Error(e) where stream_send returns Err(actual) and actual != e (e.g. FlowControl instead of StreamStopped).

Common situations: quiche error-enum variants changed between versions; the same failure surfaces through a different error path (connection-level vs stream-level); script reused against a server behaving slightly differently.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of cloudflare/quiche@9f96daa2c2 (2026-09-08). Data as JSON: /api/errors/98424348e10a1f77. Report an issue: GitHub.

Appendix: source

Thrown at h3i/src/client/mod.rs:142

                Ok(actual_bytes) if actual_bytes == *expected_bytes => {},
                Ok(actual_bytes) => panic!(
                    "Expected stream_send on stream {} to write {} bytes, got {}",
                    stream_id, expected_bytes, actual_bytes
                ),
                Err(err) => panic!(
                    "Expected stream_send on stream {} to write {} bytes, got error: {:?}",
                    stream_id, expected_bytes, err
                ),
            }
        },
        ExpectedStreamSendResult::Error(expected_err) => {
            match result {
                Ok(written) => panic!(
                    "Expected stream_send on stream {} to fail with {:?}, but wrote {} bytes",
                    stream_id, expected_err, written
                ),
                Err(actual_err) if &actual_err == expected_err => {},
                Err(actual_err) => panic!(
                    "Expected stream_send on stream {} to fail with {:?}, got {:?}",
                    stream_id, expected_err, actual_err
                ),
            }
        },
    }
}

pub(crate) fn execute_action<F: quiche::BufFactory>(
    action: &Action, conn: &mut quiche::Connection<F>,
    stream_parsers: &mut StreamParserMap,
) {
    match action {
        Action::SendFrame {
            stream_id,
            fin_stream,
            frame,
            expected_result,

View on GitHub (pinned to 9f96daa2c2)