risingwavelabs/risingwave · error · SinkError

schemas.enable is expected to be `true` or `false`, got {s}

Error message

schemas.enable is expected to be `true` or `false`, got {s}

What it means

When building a Debezium/Avro encoder with Kafka Connect schema-registry metadata, the option `schemas.enable` must be the boolean `true` or `false`. If its string value parses to neither, `build` returns this Config error because the encoder cannot decide whether to embed schemas in records.

Source

Thrown at src/connector/src/sink/formatter/mod.rs:158

            b.schema,
            pk_indices,
            DateHandlingMode::FromCe,
            TimestampHandlingMode::Milli,
            timestamptz_mode,
            TimeHandlingMode::Milli,
            jsonb_handling_mode,
        );
        let encoder = if let Some(s) = b.format_desc.options.get("schemas.enable") {
            match s.to_lowercase().parse::<bool>() {
                Ok(true) => {
                    let kafka_connect = KafkaConnectParams {
                        schema_name: format!("{}.{}", b.db_name, b.sink_from_name),
                    };
                    encoder.with_kafka_connect(kafka_connect)
                }
                Ok(false) => encoder,
                _ => {
                    return Err(SinkError::Config(anyhow!(
                        "schemas.enable is expected to be `true` or `false`, got {s}",
                    )));
                }
            }
        } else {
            encoder
        };
        Ok(encoder)
    }
}

impl EncoderBuild for ProtoEncoder {
    async fn build(b: EncoderParams<'_>, pk_indices: Option<Vec<usize>>) -> Result<Self> {
        // TODO: better to be a compile-time assert
        assert!(pk_indices.is_none());
        // By passing `None` as `aws_auth_props`, reading from `s3://` not supported yet.
        let (descriptor, sid) =
            crate::schema::protobuf::fetch_descriptor(&b.format_desc.options, b.topic, None)

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Set `schemas.enable='true'` or `schemas.enable='false'` exactly (lowercase boolean)
  2. Remove the option entirely if you want the default behavior (treated as disabled)
  3. Check for quoting/nesting issues in the WITH clause that could prepend/append characters

Example fix

// before
WITH (... schemas.enable = 'yes')
// after
WITH (... schemas.enable = 'true')
Defensive patterns

Strategy: validation

Validate before calling

const v = opts['schemas.enable'];
if (v !== undefined && v !== 'true' && v !== 'false') {
  throw new Error(`schemas.enable must be 'true' or 'false', got ${v}`);
}

Type guard

const isKafkaConnectBool = (v) => v === 'true' || v === 'false';

Try / catch

try { buildFormatter(opts); } catch (e) { if (String(e).includes('schemas.enable')) { opts['schemas.enable'] = 'false'; buildFormatter(opts); } else { throw e; } }

Prevention

When it happens

Trigger: Setting `schemas.enable='yes'`, `'1'`, `'on'`, or any non-boolean string in the sink/format options of a Kafka Connect-compatible formatter build.

Common situations: Copy-pasting Kafka Connect worker configs where schemas.enable is a Java boolean (which still requires true/false) or accidentally quoting/nesting the value incorrectly.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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