DioxusLabs/dioxus · error
protocols is an invalid header value
Error message
protocols is an invalid header value
What it means
The client websocket handshake tried to build a header value (e.g. the Sec-WebSocket-Key nonce or subprotocol list) that is not a valid HTTP header value (control characters, non-ASCII, or invalid token).
Solutions
- Use only valid header-value characters in the WebSocket `protocols` value; remove commas/whitespace issues or non-visible ASCII characters.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/fullstack/src/payloads/websocket.rs:1261 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/25a82462c3d2d554.
Report an issue: GitHub.
Appendix: source
Thrown at packages/fullstack/src/payloads/websocket.rs:1261
HeaderValue::from_static("upgrade"),
);
headers.insert(
reqwest::header::UPGRADE,
HeaderValue::from_static("websocket"),
);
headers.insert(
reqwest::header::SEC_WEBSOCKET_KEY,
HeaderValue::from_str(&nonce_value).expect("nonce is a invalid header value"),
);
headers.insert(
reqwest::header::SEC_WEBSOCKET_VERSION,
HeaderValue::from_static("13"),
);
if !protocols.is_empty() {
headers.insert(
reqwest::header::SEC_WEBSOCKET_PROTOCOL,
HeaderValue::from_str(&protocols.join(", "))
.expect("protocols is an invalid header value"),
);
}
Some(nonce_value)
}
Version::HTTP_2 => {
// TODO: Implement websocket upgrade for HTTP 2.
return Err(HandshakeError::UnsupportedHttpVersion(version).into());
}
_ => {
return Err(HandshakeError::UnsupportedHttpVersion(version).into());
}
};
// execute request
let response = client.execute(request).await?;
Ok(WebSocketResponse {View on GitHub (pinned to 24f6a829df)