risingwavelabs/risingwave · error · SinkError::Config

Cannot find `{VALUE_FORMAT}`, please set it or use JSON

Error message

Cannot find `{VALUE_FORMAT}`, please set it or use JSON

What it means

When creating a Redis sink with template encoding and value type `string` (the default), both a `key_format` and a `value_format` template are required. The `validate` step throws this SinkError::Config when `value_format` is missing from the options map, instructing the user to set it or use a JSON encoding.

Source

Thrown at src/connector/src/sink/redis.rs:360

            super::catalog::SinkEncode::Template
        ) {
            match self
                .format_desc
                .options
                .get(REDIS_VALUE_TYPE)
                .map(|s| s.as_str())
            {
                // if not set, default to string
                Some(REDIS_VALUE_TYPE_STRING) | None => {
                    let key_format = self.format_desc.options.get(KEY_FORMAT).ok_or_else(|| {
                        SinkError::Config(anyhow!(
                            "Cannot find '{KEY_FORMAT}', please set it or use JSON"
                        ))
                    })?;
                    TemplateStringEncoder::check_string_format(key_format, &pk_map)?;
                    let value_format =
                        self.format_desc.options.get(VALUE_FORMAT).ok_or_else(|| {
                            SinkError::Config(anyhow!(
                                "Cannot find `{VALUE_FORMAT}`, please set it or use JSON"
                            ))
                        })?;
                    TemplateStringEncoder::check_string_format(value_format, &all_map)?;
                }
                Some(REDIS_VALUE_TYPE_GEO) => {
                    let key_format = self.format_desc.options.get(KEY_FORMAT).ok_or_else(|| {
                        SinkError::Config(anyhow!(
                            "Cannot find '{KEY_FORMAT}', please set it or use JSON"
                        ))
                    })?;
                    TemplateStringEncoder::check_string_format(key_format, &pk_map)?;

                    let lon_name = self.format_desc.options.get(LON_NAME).ok_or_else(|| {
                        SinkError::Config(anyhow!(
                            "Cannot find `{LON_NAME}`, please set it or use JSON or set `{REDIS_VALUE_TYPE}` to `{REDIS_VALUE_TYPE_STRING}`"
                        ))
                    })?;

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Add `value_format = '<template>'` to the ENCODE TEMPLATE options, e.g. value_format = '{column1}'
  2. Switch to a JSON-based encoding that does not require value_format
  3. Verify the option name is exactly `value_format`

Example fix

-- before
... encode template (key_format = 'kv::{pk}')
-- after
... encode template (key_format = 'kv::{pk}', value_format = 'v={v}')
Defensive patterns

Strategy: validation

Validate before calling

-- ensure both templates exist for string-type template Redis sinks:
-- options.contains_key("key_format") && options.contains_key("value_format")

Try / catch

match result.err() { Some(e) if e.contains("value_format") => add_missing_option("value_format"), _ => propagate(result) }

Prevention

When it happens

Trigger: CREATE SINK with connector='redis', template encoding, `redis_value_type` = 'string' or unset, where `key_format` is provided but no `value_format` option exists in the FORMAT ... ENCODE ... options (src/connector/src/sink/redis.rs:358-363).

Common situations: Setting only `key_format` because the key template seems sufficient; copying a GEO/PUBSUB example that has no `value_format` into a string-type sink; typos like `valueformat` or `value-format`.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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