{"id":"bce2229c42f114a1","repo":"hyperium/hyper","slug":"partial-header","errorCode":null,"errorMessage":"Partial header","messagePattern":"Partial header","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"src/proto/h1/decode.rs","lineNumber":672,"sourceCode":"                    }\n                };\n\n                let value = match HeaderValue::from_bytes(header.value) {\n                    Ok(value) => value,\n                    Err(_) => {\n                        return Err(io::Error::new(\n                            io::ErrorKind::InvalidInput,\n                            format!(\"Invalid header value: {:?}\", &header),\n                        ));\n                    }\n                };\n\n                trailers.append(name, value);\n            }\n\n            Ok(trailers)\n        }\n        Ok(httparse::Status::Partial) => Err(io::Error::new(\n            io::ErrorKind::InvalidInput,\n            \"Partial header\",\n        )),\n        Err(e) => Err(io::Error::new(io::ErrorKind::InvalidInput, e)),\n    }\n}\n\n#[derive(Debug)]\nstruct IncompleteBody;\n\nimpl fmt::Display for IncompleteBody {\n    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n        write!(f, \"end of file before message length reached\")\n    }\n}\n\nimpl StdError for IncompleteBody {}\n","sourceCodeStart":654,"sourceCodeEnd":690,"githubUrl":"https://github.com/hyperium/hyper/blob/084473f728f9d07b3be5845475aa2f62ed9ff579/src/proto/h1/decode.rs#L654-L690","documentation":"Thrown by decode_trailers (src/proto/h1/decode.rs:672) when httparse::parse_headers returns Status::Partial on the buffered trailer block — meaning the accumulated bytes do not form a complete, properly-terminated set of headers (no final blank-line CRLF that the parser accepts as Complete). Reported as io::ErrorKind::InvalidInput.","triggerScenarios":"A trailer block that is internally cut off or mis-sequenced so httparse sees it as partial — e.g. trailers that reached the byte-size cap (TRAILER_LIMIT / h1_max_header_size) mid-header, or framing where the terminating blank line is malformed. The state machine reached End but the bytes collected in trailers_buf don't parse cleanly.","commonSituations":"A trailer that exceeds the trailer byte cap (h1_max_header_size, default 16 KiB) causing the buffer to be cut mid-header; a peer that emits trailers without the final blank line; interference from a proxy that rewrites the trailer section.","solutions":["Raise h1_max_header_size via the builder if a legitimate trailer is larger than the 16 KiB default.","Confirm the sender writes the trailer-terminating blank line (\"\\r\\n\") after the last trailer.","Split oversized trailer values or move them into the body.","Capture the trailer bytes and run httparse on them locally to see exactly where parsing goes partial."],"exampleFix":"// before: default 16 KiB trailer cap, oversized trailer truncated\nlet srv = Server::bind(&addr).serve(make_svc);\n\n// after: raise trailer byte limit\nlet srv = Server::bind(&addr)\n    .http1_max_header_size(1024 * 64)\n    .serve(make_svc);","handlingStrategy":"validation","validationCode":"// Size trailer budgets to fit within h1_max_header_size (default 16 KiB).\nlet max_header_size = 1024 * 64; // raise the cap to fit legitimate trailers\nlet server = hyper::server::Server::bind(&addr)\n    .http1_max_header_size(max_header_size)\n    .serve(make_svc);\n// On send: ensure each trailer line + the final blank line fit the cap.\nassert!(trailer_block.len() < max_header_size);","typeGuard":null,"tryCatchPattern":"Some(Err(e)) => {\n    if e.to_string().contains(\"Partial header\") {\n        tracing::warn!(error=%e, \"trailer block parsed as partial; check h1_max_header_size / terminator\");\n        break;\n    }\n    return Err(e.into());\n}","preventionTips":["Set h1_max_header_size above the largest legitimate trailer line on both server and client.","Always terminate the trailer block with a blank CRLF line.","If a trailer is huge, move the payload into the body."],"tags":["http","http1","chunked","trailers","headers","limits","hyper","rust"],"analyzedSha":"084473f728f9d07b3be5845475aa2f62ed9ff579","analyzedAt":"2026-08-06T01:20:18.522Z","schemaVersion":2}