risingwavelabs/risingwave · error · RequestError::Json

confluent registry parse resp error: {0}

Error message

confluent registry parse resp error: {0}

What it means

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.

Source

Thrown at src/connector/src/schema/schema_registry/util.rs:91

    let schema_id = cursor
        .read_i32::<BigEndian>()
        .map_err(|_| WireFormatError::NoSchemaId)?;

    Ok((schema_id, cursor))
}

pub(crate) struct SchemaRegistryCtx {
    pub username: Option<String>,
    pub password: Option<String>,
    pub client: reqwest::Client,
    pub path: Vec<String>,
}

#[derive(Debug, thiserror::Error)]
pub enum RequestError {
    #[error("confluent registry send req error: {0}")]
    Send(#[source] reqwest::Error),
    #[error("confluent registry parse resp error: {0}")]
    Json(#[source] reqwest::Error),
    #[error(transparent)]
    Unsuccessful(ErrorResp),
}

pub(crate) async fn req_inner<T>(
    ctx: Arc<SchemaRegistryCtx>,
    mut url: Url,
    method: Method,
) -> Result<T, RequestError>
where
    T: DeserializeOwned + Send + Sync + 'static,
{
    url.path_segments_mut()
        .expect("constructor validated URL can be a base")
        .extend(&ctx.path);
    tracing::debug!("request to url: {}, method {}", &url, &method);
    let mut request_builder = ctx.client.request(method, url);

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Check the HTTP status/content-type actually returned (log or curl the exact endpoint URL).
  2. Verify the schema registry version is compatible with the expected REST API (docs.confluent.io API v1).
  3. If a proxy is involved, fix it to pass through registry JSON responses instead of HTML error pages.
  4. Verify the request path (subject name, version) is correct so the registry returns the expected payload.

Example fix

// before: hitting wrong path
let url = format!("{}/subjects/{}/versions/latestx", base, subject);
// after
let url = format!("{}/subjects/{}/versions/latest", base, subject);
Defensive patterns

Strategy: try-catch

Validate before calling

// sanity: endpoint returns JSON
let resp = reqwest::get(format!("{}/subjects", registry_url)).await?;
assert!(resp.headers().get("content-type").map_or(false, |v| v.to_string().contains("application/json")));

Try / catch

match req_inner(&ctx).await {
    Ok(v) => v,
    Err(RequestError::Json(e)) => {
        tracing::warn!(error = ?e, "registry returned non-JSON body; check proxy/registry version");
        Err(e.into())
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: 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).

Common situations: Reverse proxy/ingress returning an HTML 502 page, incompatible schema registry version (different API response), or hitting the wrong endpoint path (path components misconfigured).

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/49cd8a328b2548b0. Report an issue: GitHub.