{"record":{"id":"49cd8a328b2548b0","repo":"risingwavelabs/risingwave","slug":"confluent-registry-parse-resp-error-0","errorCode":null,"errorMessage":"confluent registry parse resp error: {0}","messagePattern":"confluent registry parse resp error: (.+?)","errorType":"exception","errorClass":"RequestError::Json","httpStatus":null,"severity":"error","filePath":"src/connector/src/schema/schema_registry/util.rs","lineNumber":91,"sourceCode":"    let schema_id = cursor\n        .read_i32::<BigEndian>()\n        .map_err(|_| WireFormatError::NoSchemaId)?;\n\n    Ok((schema_id, cursor))\n}\n\npub(crate) struct SchemaRegistryCtx {\n    pub username: Option<String>,\n    pub password: Option<String>,\n    pub client: reqwest::Client,\n    pub path: Vec<String>,\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum RequestError {\n    #[error(\"confluent registry send req error: {0}\")]\n    Send(#[source] reqwest::Error),\n    #[error(\"confluent registry parse resp error: {0}\")]\n    Json(#[source] reqwest::Error),\n    #[error(transparent)]\n    Unsuccessful(ErrorResp),\n}\n\npub(crate) async fn req_inner<T>(\n    ctx: Arc<SchemaRegistryCtx>,\n    mut url: Url,\n    method: Method,\n) -> Result<T, RequestError>\nwhere\n    T: DeserializeOwned + Send + Sync + 'static,\n{\n    url.path_segments_mut()\n        .expect(\"constructor validated URL can be a base\")\n        .extend(&ctx.path);\n    tracing::debug!(\"request to url: {}, method {}\", &url, &method);\n    let mut request_builder = ctx.client.request(method, url);","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/schema/schema_registry/util.rs#L73-L109","documentation":"RequestError::Json is returned when the schema registry responded but the response body could not be deserialized into the expected type (via reqwest's JSON handling), wrapping the underlying reqwest::Error. The HTTP exchange succeeded but the body is not the expected JSON shape.","triggerScenarios":"Calling a registry endpoint whose response body fails serde deserialization — HTML error pages from proxies, a registry version returning a different JSON schema, or an unexpected content-type (e.g. text/plain).","commonSituations":"Reverse proxy/ingress returning an HTML 502 page, incompatible schema registry version (different API response), or hitting the wrong endpoint path (path components misconfigured).","solutions":["Check the HTTP status/content-type actually returned (log or curl the exact endpoint URL).","Verify the schema registry version is compatible with the expected REST API (docs.confluent.io API v1).","If a proxy is involved, fix it to pass through registry JSON responses instead of HTML error pages.","Verify the request path (subject name, version) is correct so the registry returns the expected payload."],"exampleFix":"// before: hitting wrong path\nlet url = format!(\"{}/subjects/{}/versions/latestx\", base, subject);\n// after\nlet url = format!(\"{}/subjects/{}/versions/latest\", base, subject);","handlingStrategy":"try-catch","validationCode":"// sanity: endpoint returns JSON\nlet resp = reqwest::get(format!(\"{}/subjects\", registry_url)).await?;\nassert!(resp.headers().get(\"content-type\").map_or(false, |v| v.to_string().contains(\"application/json\")));","typeGuard":null,"tryCatchPattern":"match req_inner(&ctx).await {\n    Ok(v) => v,\n    Err(RequestError::Json(e)) => {\n        tracing::warn!(error = ?e, \"registry returned non-JSON body; check proxy/registry version\");\n        Err(e.into())\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Ensure proxies/ingress pass through registry JSON, not HTML error pages.","Keep schema registry version compatible with the REST API used.","Verify endpoint paths (subject/version) are correct.","Log response content-type on deserialization failures for diagnosis."],"tags":["json","http","schema-registry"],"backgroundTag":"json-decode-failed","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"}