risingwavelabs/risingwave · error · SinkError::Config

unsupported {} as sink key encode

Error message

unsupported {} as sink key encode

What it means

The key_encode option defines how the sink's key is serialized. Values like Json, Protobuf, Template, Native, Parquet, and None cannot be used as a key encode, so try_from rejects them with this config error.

Source

Thrown at src/connector/src/sink/catalog/mod.rs:269

                return Err(SinkError::Config(anyhow!(
                    "sink encode unsupported: {}",
                    e.as_str_name()
                )));
            }
        };
        let key_encode = match &value.key_encode() {
            E::Bytes => Some(SinkEncode::Bytes),
            E::Text => Some(SinkEncode::Text),
            E::Unspecified => None,
            encode @ (E::Avro
            | E::Csv
            | E::Json
            | E::Protobuf
            | E::Template
            | E::Native
            | E::Parquet
            | E::None) => {
                return Err(SinkError::Config(anyhow!(
                    "unsupported {} as sink key encode",
                    encode.as_str_name()
                )));
            }
        };

        Ok(Self {
            format,
            encode,
            options: value.options,
            key_encode,
            secret_refs: value.secret_refs,
            connection_id: value.connection_id,
        })
    }
}

/// the catalog of the sink. There are two kind of schema here. The full schema is all columns

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Use a key-capable encode for key_encode (e.g. compatible row-encode formats supported for keys).
  2. Remove the key_encode option entirely if the connector derives keys automatically.
  3. Consult the specific connector docs for which key encodes are valid.

Example fix

// before
WITH (connector='kafka', format='upsert', encode='json', key_encode='json', ...)
// after
WITH (connector='kafka', format='upsert', encode='json', key_encode='bytes', ...) // or omit key_encode
Defensive patterns

Strategy: validation

Validate before calling

const BAD_KEY_ENCODES = ['json', 'protobuf', 'template', 'native', 'parquet', 'none'];
if (props.key_encode && BAD_KEY_ENCODES.includes(props.key_encode)) throw new Error(`Unsupported key encode: ${props.key_encode}`);

Prevention

When it happens

Trigger: CREATE SINK ... WITH (key_encode='<json|protobuf|template|native|parquet|none>') — i.e. any key_encode value outside the allowed key-encodable set.

Common situations: Copying the main `encode` value into `key_encode` assuming they accept the same set; setting key_encode for sinks that derive keys internally.

Related errors


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