risingwavelabs/risingwave · error · MalformedResponseError

Malformed response: {message}

Error message

Malformed response: {message}

What it means

MalformedResponseError indicates a schema registry (Confluent/Glue) response arrived but could not be decoded into the expected structure — wrong content type, unexpected JSON shape, or missing fields.

Source

Thrown at src/connector/src/schema/mod.rs:40

pub use loader::{ConfluentSchemaLoader, SchemaLoader, SchemaVersion};

const MESSAGE_NAME_KEY: &str = "message";
const KEY_MESSAGE_NAME_KEY: &str = "key.message";
const SCHEMA_LOCATION_KEY: &str = "schema.location";
const SCHEMA_REGISTRY_KEY: &str = "schema.registry";
const NAME_STRATEGY_KEY: &str = "schema.registry.name.strategy";
pub const AWS_GLUE_SCHEMA_ARN_KEY: &str = "aws.glue.schema_arn";

#[derive(Debug, thiserror::Error, thiserror_ext::Macro)]
#[error("Invalid option: {message}")]
pub struct InvalidOptionError {
    pub message: String,
    // #[backtrace]
    // source: Option<risingwave_common::error::BoxedError>,
}

#[derive(Debug, thiserror::Error, thiserror_ext::Macro)]
#[error("Malformed response: {message}")]
pub struct MalformedResponseError {
    pub message: String,
}

#[derive(Debug, thiserror::Error)]
pub enum SchemaFetchError {
    #[error(transparent)]
    InvalidOption(#[from] InvalidOptionError),
    #[error(transparent)]
    License(#[from] risingwave_common::license::FeatureNotAvailable),
    #[error(transparent)]
    Request(#[from] schema_registry::ConcurrentRequestError),
    #[error(transparent)]
    AwsGlue(#[from] Box<aws_sdk_glue::operation::get_schema_version::GetSchemaVersionError>),
    #[error(transparent)]
    MalformedResponse(#[from] MalformedResponseError),
    #[error("schema version id invalid: {0}")]
    InvalidUuid(#[from] uuid::Error),

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Verify schema.registry points to a real Confluent Schema Registry endpoint (curl /subjects).
  2. Inspect the raw response — remove proxies/auth layers that return HTML or unexpected bodies.
  3. Upgrade/downgrade RisingWave if the registry version changed its API response format.

Example fix

// before
WITH (schema.registry = 'http://localhost:8080') // points to Kafka, not registry
// after
WITH (schema.registry = 'http://localhost:8081')
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: registry must return JSON on /subjects
curl -fsS -H 'Accept: application/vnd.schemaregistry.v1+json' http://registry:8081/subjects

Try / catch

match fetch_schema() {
    Err(e) if e.to_string().starts_with("Malformed response") => {
        // verify endpoint is a real schema registry; inspect raw body
    }
    Err(e) => return Err(e.into()),
    Ok(s) => s,
}

Prevention

When it happens

Trigger: The HTTP response body from the schema registry cannot be deserialized into the expected schema/model type; raised via thiserror::Macro when parsing registry responses.

Common situations: Pointing schema.registry at a non-registry service (proxy returning HTML error pages); an incompatible registry version returning a different JSON shape; auth middleware returning HTML login pages with 200.

Understand the failure class

Related errors


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