{"record":{"id":"1b592122e03b8d9b","repo":"vectordotdev/vector","slug":"invalid-ack-decoding-config","errorCode":null,"errorMessage":"Invalid `ack_decoding` config.","messagePattern":"Invalid `ack_decoding` config\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/sinks/websocket_server/buffering.rs","lineNumber":253,"sourceCode":"            ..\n        }) = self\n            && let Some(log) = event.maybe_as_log_mut()\n        {\n            let mut buffer = [0; 36];\n            let uuid = message_id.hyphenated().encode_lower(&mut buffer);\n            log.value_mut()\n                .insert(message_id_path, Bytes::copy_from_slice(uuid.as_bytes()));\n        }\n        message_id\n    }\n\n    fn handle_ack_request(&self, request: Message) -> Option<Uuid> {\n        let ack_config = self.as_ref().and_then(|mb| mb.client_ack_config.as_ref())?;\n\n        let parsed_message = ack_config\n            .ack_decoding\n            .build()\n            .expect(\"Invalid `ack_decoding` config.\")\n            .parse(request.into_data().into(), Default::default())\n            .inspect_err(|err| {\n                debug!(message = \"Parsing ACK request failed.\", %err);\n            })\n            .ok()?;\n\n        let Some(message_id_field) = parsed_message\n            .first()?\n            .maybe_as_log()?\n            .value()\n            .get(&ack_config.message_id_path)\n        else {\n            debug!(\"Couldn't find message ID in ACK request.\");\n            return None;\n        };\n\n        message_id_field\n            .try_bytes_utf8_lossy()","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/sinks/websocket_server/buffering.rs#L235-L271","documentation":"handle_ack_request builds a decoder from the client's ack_decoding config for every ACK request. The DecodingConfig::build() call is unwrapped with expect(\"Invalid `ack_decoding` config.\"), so a config that cannot produce a decoder panics the connection handler. Note the .parse() afterwards is handled gracefully; only build() failure is fatal.","triggerScenarios":"A client connects with an embedded ack configuration whose ack_decoding (codec/charset options) fails DecoderConfig build — e.g. an unsupported codec or invalid combination in the per-client ACK payload config — then sends an ACK request message.","commonSituations":"WebSocket clients embedding a malformed or unsupported ack_decoding spec in their connection handshake/first message; typo'd codec name in the client's advertised config.","solutions":["Fix the client's ack_decoding configuration to use a supported codec (e.g. json, text) with valid options.","Validate the ack_decoding config once at connection setup (call build() early and reject the handshake) instead of panicking per message.","Replace the expect with graceful handling: log and skip ACK processing (return None) when the decoder cannot be built."],"exampleFix":"// before\n.expect(\"Invalid `ack_decoding` config.\")\n.parse(request.into_data().into(), Default::default())\n// after\nlet decoder = match ack_config.ack_decoding.build() {\n    Ok(d) => d,\n    Err(err) => {\n        debug!(message = \"Invalid `ack_decoding` config.\", %err);\n        return None;\n    }\n};\ndecoder.parse(request.into_data().into(), Default::default())","handlingStrategy":"validation","validationCode":"// validate the client-provided ack config before accepting ACKs\nlet decoder = ack_config.ack_decoding.build()?; // reject connection on error","typeGuard":null,"tryCatchPattern":"match ack_config.ack_decoding.build() { Ok(d) => d, Err(err) => { debug!(%err, \"Invalid ack_decoding\"); return None; } }","preventionTips":["Validate ack_decoding once at handshake and reject the connection on failure.","Keep per-client codec config limited to supported codecs.","Test the websocket_server sink with clients sending malformed ack configs."],"tags":["rust","panic","websocket","configuration","decoding"],"backgroundTag":"invalid-config-value","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"}