{"record":{"id":"92317bdcff125713","repo":"vllm-project/vllm","slug":"messagepack-encode-failed-for-target-type-mess","errorCode":null,"errorMessage":"messagepack encode failed for {target_type}: {message}","messagePattern":"messagepack encode failed for (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"rust/src/engine-core-client/src/error.rs","lineNumber":17,"sourceCode":"// SPDX-License-Identifier: Apache-2.0\n// SPDX-FileCopyrightText: Copyright contributors to the vLLM project\n\nuse std::sync::Arc;\nuse std::time::Duration;\n\nuse thiserror::Error;\nuse thiserror_ext::Macro;\n\nuse crate::protocol::utility::UtilityCallId;\n\npub type Result<T> = std::result::Result<T, Error>;\n\n/// Public error type for the Rust engine-core client.\n#[derive(Debug, Error, Macro)]\npub enum Error {\n    #[error(\"messagepack encode failed for {target_type}: {message}\")]\n    Encode {\n        target_type: &'static str,\n        message: String,\n    },\n    #[error(\"messagepack decode failed for {target_type}: {message}\")]\n    Decode {\n        target_type: &'static str,\n        message: String,\n    },\n    #[error(\"messagepack value decode failed\")]\n    ValueDecode(#[from] rmpv::decode::Error),\n    #[error(\"messagepack ext value decode failed: {message}\")]\n    ExtValueDecode { message: String },\n    #[error(\"invalid structured outputs params: {message}\")]\n    InvalidStructuredOutputsParams { message: String },\n    #[error(\"io error\")]\n    Io(#[from] std::io::Error),\n    #[error(\"transport error\")]","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/engine-core-client/src/error.rs#L1-L35","documentation":"A MessagePack serialization failure. The crate encodes every request and handshake message with rmp_serde::to_vec_named (rust/src/engine-core-client/src/protocol/mod.rs:43) and utility-call args with rmpv::ext::to_value (protocol/utility.rs:177); when serialization fails, the error is wrapped as Error::Encode { target_type, message } where target_type names the exact struct being encoded. It means a Rust value could not be represented as MessagePack, typically because a field type or enum shape is not serializable.","triggerScenarios":"Encoding an EngineCoreRequest whose payload contains a non-serializable field (e.g. a type with no Serialize impl, a map with non-string keys, or an enum without serde tag attributes), or a HandshakeInitMessage / utility-call args value that fails rmp_serde/rmpv serialization. Raised from encode_msgpack before any bytes hit the wire.","commonSituations":"Adding a new field to EngineCoreRequest or a multimodal feature struct and forgetting #[serde(with ...)]/skip attributes. Version skew between the Rust frontend and the Python EngineCore after the wire schema changed. Custom types in reasoning_parser_kwargs or structured-output options that serde cannot serialize.","solutions":["Check target_type in the error to find the exact struct, then audit its serde attributes (skip, skip_serializing_if, with)","Reproduce locally: rmp_serde::to_vec_named(&value) in a unit test over the failing request to see the underlying serde message","Align the Rust and Python schema versions if a field type changed on one side only","For new fields, mirror existing patterns: #[serde(default)] plus Option<T>"],"exampleFix":"// before\npub mm_features: Option<Vec<MultimodalFeature>>, // inner tensor type lacks Serialize\n\n// after\n#[serde(default, skip_serializing_if = \"Option::is_none\")]\npub mm_features: Option<Vec<MultimodalFeature>>, // MultimodalFeature derives Serialize\n","handlingStrategy":"try-catch","validationCode":"fn can_encode<T: serde::Serialize>(value: &T) -> bool {\n    rmp_serde::to_vec_named(value).is_ok()\n}","typeGuard":"fn is_encode_error(e: &engine_core_client::Error) -> bool {\n    matches!(e, engine_core_client::Error::Encode { .. })\n}","tryCatchPattern":"match result {\n    Err(e @ engine_core_client::Error::Encode { target_type, .. }) => {\n        tracing::warn!(target_type, %e, \"request not encodable; dropping\");\n    }\n    other => other?,\n}","preventionTips":["Pre-encode candidate request shapes in unit tests so schema breakage is caught at CI time","Derive Serialize on all wire structs and lint against un-annotated fields","Pin engine and crate versions together in one lockstep release"],"tags":["rust","serialization","messagepack","protocol"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}