{"record":{"id":"ec5883c0ab6bd06b","repo":"DioxusLabs/dioxus","slug":"failed-to-serialize-message","errorCode":null,"errorMessage":"Failed to serialize message","messagePattern":"Failed to serialize message","errorType":"exception","errorClass":"WebsocketError","httpStatus":null,"severity":"error","filePath":"packages/fullstack/src/payloads/websocket.rs","lineNumber":840,"sourceCode":"        }\n    }\n}\n\n#[cfg(feature = \"server\")]\nimpl<In: DeserializeOwned, Out: Serialize, E: Encoding> Sink<Out> for TypedWebsocket<In, Out, E> {\n    type Error = WebsocketError;\n\n    fn poll_ready(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {\n        Pin::new(&mut self.inner)\n            .poll_ready(cx)\n            .map_err(|_| WebsocketError::AlreadyClosed)\n    }\n\n    fn start_send(mut self: Pin<&mut Self>, item: Out) -> Result<(), Self::Error> {\n        use axum::extract::ws::Message;\n\n        let to_bytes = E::to_bytes(&item).ok_or_else(|| {\n            WebsocketError::Serialization(anyhow::anyhow!(\"Failed to serialize message\").into())\n        })?;\n\n        Pin::new(&mut self.inner)\n            .start_send(Message::Binary(to_bytes))\n            .map_err(|_| WebsocketError::AlreadyClosed)\n    }\n\n    fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {\n        Pin::new(&mut self.inner)\n            .poll_flush(cx)\n            .map_err(|_| WebsocketError::AlreadyClosed)\n    }\n\n    fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {\n        Pin::new(&mut self.inner)\n            .poll_close(cx)\n            .map_err(|_| WebsocketError::AlreadyClosed)\n    }","sourceCodeStart":822,"sourceCodeEnd":858,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/fullstack/src/payloads/websocket.rs#L822-L858","documentation":"Sink::start_send failure for TypedWebsocket on the server: E::to_bytes could not serialize the outgoing Out message into axum's ws Message, so WebsocketError with this message is returned to the caller of send. The faulting input is the message value that the chosen Encoding cannot serialize.","triggerScenarios":"Thrown at packages/fullstack/src/payloads/websocket.rs:840 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The websocket message could not be serialized. Ensure the message type implements Serialize and contains valid data."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}