risingwavelabs/risingwave · error · SinkError::Config

Cannot find '{KEY_FORMAT}', please set it or use JSON (geo v

Error message

Cannot find '{KEY_FORMAT}', please set it or use JSON (geo value type)

What it means

When a Redis sink uses template encoding with `redis_value_type = 'geospatial'`, a `key_format` template defining the GEO set key is mandatory. RedisSink::validate raises this SinkError::Config when the `key_format` option cannot be found, suggesting either setting it or falling back to the string value type.

Source

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

                // 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}`"
                        ))
                    })?;
                    let lat_name = self.format_desc.options.get(LAT_NAME).ok_or_else(|| {
                        SinkError::Config(anyhow!(
                            "Cannot find `{LAT_NAME}`, please set it or use JSON or set `{REDIS_VALUE_TYPE}` to `{REDIS_VALUE_TYPE_STRING}`"
                        ))
                    })?;
                    let member_name = self.format_desc.options.get(MEMBER_NAME).ok_or_else(|| {
                        SinkError::Config(anyhow!(
                            "Cannot find `{MEMBER_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 `key_format = '<template>'` to the sink options, e.g. key_format = 'geo::{pk}'
  2. Or change redis_value_type to 'string' which uses a different option set
  3. Confirm the option key is spelled `key_format`

Example fix

-- before
... encode template (redis_value_type = 'geospatial', longitude = 'lon', latitude = 'lat', member = 'm')
-- after
... encode template (redis_value_type = 'geospatial', key_format = 'geo::{pk}', longitude = 'lon', latitude = 'lat', member = 'm')
Defensive patterns

Strategy: validation

Validate before calling

-- for redis_value_type='geospatial', verify key_format exists before DDL:
-- options.contains_key("key_format")

Try / catch

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

Prevention

When it happens

Trigger: CREATE SINK with connector='redis', encode template, `redis_value_type = 'geospatial'`, and no `key_format` option in the sink options (src/connector/src/sink/redis.rs:366-371).

Common situations: Configuring GEOADD-style sinks and providing only longitude/latitude/member but forgetting key_format; migrating a string-type sink config to geospatial without adding key_format; misspelling the option.

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/2fc9ef7ef92ebbc4. Report an issue: GitHub.