actix/actix-web · error · ProtocolError
unknown continuation fragment: {}
Error message
unknown continuation fragment: {} What it means
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.
Source
Thrown at actix-http/src/ws/mod.rs:62
/// Bad opcode.
#[display("bad opcode")]
BadOpCode,
/// A payload reached size limit.
#[display("payload reached size limit")]
Overflow,
/// Continuation has not started.
#[display("continuation has not started")]
ContinuationNotStarted,
/// Received new continuation but it is already started.
#[display("received new continuation but it has already started")]
ContinuationStarted,
/// Unknown continuation fragment.
#[display("unknown continuation fragment: {}", _0)]
ContinuationFragment(#[error(not(source))] OpCode),
/// I/O error.
#[display("I/O error: {}", _0)]
Io(io::Error),
}
/// WebSocket handshake errors
#[derive(Debug, Clone, Copy, PartialEq, Eq, Display, Error)]
pub enum HandshakeError {
/// Only get method is allowed.
#[display("method not allowed")]
GetMethodRequired,
/// Upgrade header if not set to WebSocket.
#[display("WebSocket upgrade is expected")]
NoWebsocketUpgrade,
View on GitHub (pinned to 937960ca67)
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.
Defensive patterns
Strategy: try-catch
Try / catch
// Handle ProtocolError from the WS dispatcher and close cleanly.
if let Err(ProtocolError::ContinuationFragment(op)) = dispatch_result {
log::error!("illegal fragmented opcode {op}; tearing down connection");
// close the actor; recovery is impossible mid-fragment
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Buggy client that fragments control frames, fuzz testing, or a proxy that splits frames incorrectly. Legitimate browsers never fragment control frames.
Related errors
- invalid opcode ({})
- invalid control frame length ({})
- Invalid chunk size line: Invalid Size
- Invalid chunk size linear white space
- Invalid chunk size LF
AI-assisted analysis of actix/actix-web@937960ca67 (2026-08-06).
Data as JSON: /data/errors/ad26e9dee705e567.json.
Report an issue: GitHub.