{"id":"ad26e9dee705e567","repo":"actix/actix-web","slug":"unknown-continuation-fragment","errorCode":null,"errorMessage":"unknown continuation fragment: {}","messagePattern":"unknown continuation fragment: (.+?)","errorType":"exception","errorClass":"ProtocolError","httpStatus":null,"severity":"error","filePath":"actix-http/src/ws/mod.rs","lineNumber":62,"sourceCode":"\n    /// Bad opcode.\n    #[display(\"bad opcode\")]\n    BadOpCode,\n\n    /// A payload reached size limit.\n    #[display(\"payload reached size limit\")]\n    Overflow,\n\n    /// Continuation has not started.\n    #[display(\"continuation has not started\")]\n    ContinuationNotStarted,\n\n    /// Received new continuation but it is already started.\n    #[display(\"received new continuation but it has already started\")]\n    ContinuationStarted,\n\n    /// Unknown continuation fragment.\n    #[display(\"unknown continuation fragment: {}\", _0)]\n    ContinuationFragment(#[error(not(source))] OpCode),\n\n    /// I/O error.\n    #[display(\"I/O error: {}\", _0)]\n    Io(io::Error),\n}\n\n/// WebSocket handshake errors\n#[derive(Debug, Clone, Copy, PartialEq, Eq, Display, Error)]\npub enum HandshakeError {\n    /// Only get method is allowed.\n    #[display(\"method not allowed\")]\n    GetMethodRequired,\n\n    /// Upgrade header if not set to WebSocket.\n    #[display(\"WebSocket upgrade is expected\")]\n    NoWebsocketUpgrade,\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/actix/actix-web/blob/937960ca67f20e14ffe2a075bf6d4593502be12c/actix-http/src/ws/mod.rs#L44-L80","documentation":"ProtocolError::ContinuationFragment(OpCode) (ws/mod.rs:63) is raised in codec.rs:257-260 when a non-final (FIN=0) frame arrives whose opcode is not Continue, Binary, or Text. Per RFC 6455 §5.4 only data frames may be fragmented; a fragmented control frame (Close/Ping/Pong) or a reserved opcode in a fragment is illegal, so actix reports the offending opcode.","triggerScenarios":"A WebSocket peer sends an unfinished (FIN bit clear) Ping, Pong, or Close frame, or interleaves a control opcode into a fragmented message incorrectly. The codec's !finished branch (codec.rs:226-261) falls through to the error arm.","commonSituations":"Buggy client that fragments control frames, fuzz testing, or a proxy that splits frames incorrectly. Legitimate browsers never fragment control frames.","solutions":["Close the connection; the peer violates the fragmentation rules of RFC 6455.","Fix the peer implementation to always set FIN=1 on Ping/Pong/Close frames.","Verify no intermediary is re-segmenting WebSocket frames."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Handle ProtocolError from the WS dispatcher and close cleanly.\nif let Err(ProtocolError::ContinuationFragment(op)) = dispatch_result {\n    log::error!(\"illegal fragmented opcode {op}; tearing down connection\");\n    // close the actor; recovery is impossible mid-fragment\n}","preventionTips":["Never fragment control frames (Close/Ping/Pong); always set FIN=1.","Only fragment Binary/Text data frames and follow RFC 6455 §5.4 ordering.","Use a vetted WS library instead of constructing frames manually."],"tags":["websocket","protocol","actix-http","peer-error"],"analyzedSha":"937960ca67f20e14ffe2a075bf6d4593502be12c","analyzedAt":"2026-08-06T01:15:46.978Z","schemaVersion":2}