{"record":{"id":"d06ad1a9e43d24b5","repo":"vllm-project/vllm","slug":"server-info-value-must-serialize","errorCode":null,"errorMessage":"server info value must serialize","messagePattern":"server info value must serialize","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust/src/server/src/server_info.rs","lineNumber":32,"sourceCode":"pub(crate) enum ServerInfoConfigFormat {\n    Text,\n    Json,\n}\n\n/// Snapshot returned by `/server_info`.\n#[derive(Debug, Clone)]\npub(crate) struct ServerInfoSnapshot {\n    vllm_config_text: String,\n    vllm_config_json: Value,\n    vllm_env: BTreeMap<String, String>,\n    system_env: BTreeMap<String, String>,\n}\n\nimpl ServerInfoSnapshot {\n    /// Capture the runtime configuration fields available to the Rust frontend.\n    pub(crate) fn from_config(config: &Config) -> Self {\n        let vllm_config_json =\n            serde_json::to_value(config).expect(\"server info value must serialize\");\n\n        Self {\n            vllm_config_text: render_config_text(&vllm_config_json),\n            vllm_config_json,\n            vllm_env: collect_vllm_env(),\n            system_env: collect_system_env(),\n        }\n    }\n\n    pub(crate) fn response(&self, config_format: ServerInfoConfigFormat) -> Value {\n        let vllm_config = match config_format {\n            ServerInfoConfigFormat::Text => Value::String(self.vllm_config_text.clone()),\n            ServerInfoConfigFormat::Json => self.vllm_config_json.clone(),\n        };\n\n        json!({\n            \"vllm_config\": vllm_config,\n            \"vllm_env\": self.vllm_env.clone(),","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/server/src/server_info.rs#L14-L50","documentation":"A panic (expect) in ServerInfoSnapshot::from_config: serde_json::to_value(config) must succeed when serializing the frontend Config for the /server info endpoints. Config derives Serialize, so this failing means a Config field holds data serde_json cannot represent — an internal invariant break, not user error in the normal path.","triggerScenarios":"A Config field (possibly added by a new feature or non-default transport-mode variant) containing a value that cannot map to JSON — e.g. a map with non-string keys serialized without a helper, or untagged enum data that hits an unserializable state. Fires during snapshot construction at startup or on config reload.","commonSituations":"Building a custom/patched frontend that adds a Config field with a map key type serde_json rejects; version skew between config producer and serializer; essentially never seen on stock builds.","solutions":["If running a patched build: audit recently added Config fields for types serde_json cannot serialize (non-string map keys without custom serde) and add #[serde(with = ...)] or convert keys to String.","Check that the Serialize derive covers enum variants you added (no untagged variants with conflicting shapes).","On stock builds, report the panic with the Config dump — it indicates a bug in the server."],"exampleFix":"// before\npub struct Config { pub extra: HashMap<u32, String>, .. }  // serde_json: key must be a string\n\n// after\npub struct Config {\n    #[serde(with = \"serde_json::map_tuple_keys\")]\n    pub extra: HashMap<u32, String>,\n    ..\n}","handlingStrategy":"try-catch","validationCode":"// if you build custom Config types, prove serializability in a test:\n#[test]\nfn config_serializes() {\n    let cfg = test_config();\n    assert!(serde_json::to_value(&cfg).is_ok());\n}","typeGuard":null,"tryCatchPattern":"let snapshot = std::panic::catch_unwind(|| {\n    ServerInfoSnapshot::from_config(&config)\n});\n// a panic here is an internal invariant break — capture it in a crash handler that logs the Config's Debug form.","preventionTips":["For any new Config field, add a serde_json round-trip test in CI.","Avoid non-string map keys in serializable config without explicit serde adapters.","Report stock-build occurrences upstream with the panic backtrace."],"tags":["panic","serialization","serde","server-info","rust","vllm"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}