{"record":{"id":"80f4cd1ae44a468c","repo":"vectordotdev/vector","slug":"source","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":"TungsteniteError","httpStatus":null,"severity":"warning","filePath":"src/sources/websocket/source.rs","lineNumber":374,"sourceCode":"    ) -> Result<(), WebSocketSourceError> {\n        let (error_message, specific_error) = match frame {\n            Some(frame) => {\n                let msg = format!(\n                    \"Connection closed by server with code '{}' and reason: '{}'\",\n                    frame.code, frame.reason\n                );\n                let err = WebSocketSourceError::RemoteClosed {\n                    frame: frame.into_owned(),\n                };\n                (msg, err)\n            }\n            None => (\n                \"Connection closed by server without a close frame\".to_string(),\n                WebSocketSourceError::RemoteClosedEmpty,\n            ),\n        };\n\n        let error = TungsteniteError::Io(std::io::Error::new(\n            std::io::ErrorKind::ConnectionAborted,\n            error_message,\n        ));\n        emit!(WebSocketReceiveError { error: &error });\n\n        Err(specific_error)\n    }\n\n    fn is_custom_pong(&self, msg_txt: &str) -> bool {\n        match self.config.pong_message.as_ref() {\n            Some(config) => config.matches(msg_txt),\n            None => false,\n        }\n    }\n}\n\nstruct PingManager {\n    interval: PingInterval,","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/sources/websocket/source.rs#L356-L392","documentation":"When the WebSocket server closes the connection, handle_close_frame inspects the close frame. If a close frame with a code exists it uses that message; if none exists, the message 'Connection closed by server without a close frame' is used and the specific error is WebSocketSourceError::RemoteClosedEmpty. Both are wrapped in an io::Error(ErrorKind::ConnectionAborted) for the emitted WebSocketReceiveError, and the specific error is returned so the source reconnects.","triggerScenarios":"handle_message or send_initial_message encounters a WebSocket message::Close; handle_close_frame finds no close-frame payload (code/reason absent), yielding 'Connection closed by server without a close frame' and WebSocketSourceError::RemoteClosedEmpty returned as Err.","commonSituations":"Server (or an intermediary) tears down the TCP connection abruptly without the WebSocket close handshake; upstream service restarts; load balancer idle timeout kills the socket; server implements close without a status code.","solutions":["Treat it as an expected reconnect: Vector restarts the source automatically; check subsequent reconnection success.","Investigate upstream server/proxy logs for abrupt TCP resets (LB idle timeouts, service restarts).","Enable ping/pong keep-alive (ping_timeout / ping interval) to detect and recover from dead connections faster.","If the server sends close frames without codes, this message is informational — handle RemoteClosedEmpty in retry logic."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match err {\n    WebSocketSourceError::RemoteClosedEmpty => info!(\"server closed without close frame; reconnecting\"),\n    other => error!(\"websocket source failed: {other:?}\"),\n}","preventionTips":["Enable keep-alive pings so dead connections are detected promptly.","Raise LB/proxy idle timeouts to avoid abrupt teardowns.","Expect reconnection on RemoteClosedEmpty; alert only if reconnects fail repeatedly."],"tags":["websocket","connection-closed","source","network","reconnect"],"backgroundTag":"connection-reset","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}