{"record":{"id":"959f06a4511d3cde","repo":"risingwavelabs/risingwave","slug":"expected-json-in-the-form-host-endpoint-url","errorCode":null,"errorMessage":"expected JSON in the form {{\"host\": \"endpoint url\"}}, but got {}","messagePattern":"expected JSON in the form (.+?)\\}, but got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/source/kafka/private_link.rs","lineNumber":207,"sourceCode":"    let endpoint = if let Ok(json) = serde_json::from_str::<serde_json::Value>(endpoint) {\n        json\n    } else {\n        serde_json::Value::String(endpoint.to_owned())\n    };\n    if matches!(endpoint, serde_json::Value::String(_)) {\n        let endpoint = endpoint.as_str().unwrap();\n        for (link, broker) in link_targets.iter().zip_eq_fast(broker_addrs.iter()) {\n            // rewrite the broker address to endpoint:port\n            broker_rewrite_map.insert(broker.to_string(), format!(\"{}:{}\", endpoint, link.port));\n        }\n    } else if matches!(endpoint, serde_json::Value::Array(_)) {\n        let endpoint_list: Vec<PrivateLinkEndpointItem> = endpoint\n            .as_array()\n            .unwrap()\n            .iter()\n            .map(|v| {\n                serde_json::from_value(v.clone()).map_err(|_| {\n                    anyhow!(\n                        \"expected JSON in the form {{\\\"host\\\": \\\"endpoint url\\\"}}, but got {}\",\n                        v\n                    )\n                })\n            })\n            .collect::<Result<Vec<_>, _>>()?;\n        for ((link, broker), endpoint) in link_targets\n            .iter()\n            .zip_eq_fast(broker_addrs.iter())\n            .zip_eq_fast(endpoint_list.iter())\n        {\n            // rewrite the broker address to endpoint:port\n            broker_rewrite_map.insert(\n                broker.to_string(),\n                format!(\"{}:{}\", endpoint.host, link.port),\n            );\n        }\n    } else {","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/source/kafka/private_link.rs#L189-L225","documentation":"Each entry of the `privatelink.endpoints` JSON array must deserialize into `PrivateLinkEndpointItem` (an object of the form {\"host\": \"endpoint url\"}). When an element of the array fails serde deserialization, this error reports the offending raw JSON value.","triggerScenarios":"`handle_privatelink_endpoint` maps over `endpoint.as_array().unwrap()` and any element fails `serde_json::from_value` — e.g. an entry is a plain string \"vpce-123\" instead of an object, or has wrong field names/types.","commonSituations":"User writes endpoints as [\"vpce-1\",\"vpce-2\"] instead of [{\"host\":\"...\"}]; wrong key name like {\"endpoint\":\"...\"}; host value missing; mixing formats between single-VPC (map) and multi-VPC (array) option shapes.","solutions":["Format each element as an object: [{\"host\":\"<broker hostname>\", ...}] matching `PrivateLinkEndpointItem` fields — consult docs for exact required keys","Ensure the value is a JSON array of objects, not strings","Validate the JSON by deserializing it locally before submitting the DDL","Align with the documented example in RisingWave's private link docs"],"exampleFix":"// before\nprivatelink.endpoints = '[\"vpce-0abc123\"]'\n// after\nprivatelink.endpoints = '[{\"host\":\"b-1.msk.us-east-1.amazonaws.com\",\"endpoint\":\"vpce-0abc123\"}]'","handlingStrategy":"validation","validationCode":"let v: Vec<serde_json::Value> = serde_json::from_str(&endpoints_json)?;\nfor item in &v {\n    serde_json::from_value::<PrivateLinkEndpointItem>(item.clone())\n        .map_err(|e| format!(\"bad endpoint entry {}: {}\", item, e))?;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use [{\"host\":\"...\", ...}] object entries, never bare strings","Copy the documented JSON shape from RisingWave private link docs","Validate JSON locally (jq) before running the DDL"],"tags":["kafka","aws","privatelink","json","config","validation"],"backgroundTag":"invalid-json-response","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}