risingwavelabs/risingwave · error · SinkError::Config

Cannot find ' ', please set it or use JSON (stream value…

Error message

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

What it means

For `value type = 'stream'`, the Redis sink also requires a `key format` template used to build the stream entry key from primary key columns. `validate` looks it up after `value format` and errors if it is missing, telling the user to set it or use JSON.

Solutions

  1. Add `key format = '<template over pk columns>'` to the sink options.
  2. Ensure the template placeholders reference primary key columns validated against `pk_map`.
  3. Check spelling of the `key format` option key.

Example fix

// before
WITH (connector='redis', value type='stream', stream='events', value format='{{v}}')
// after
WITH (connector='redis', value type='stream', stream='events', key format='{{id}}', value format='{{v}}')
Defensive patterns

Strategy: validation

Validate before calling

if (opts['value type'] === 'stream' && !opts['key format']) throw new Error('stream sink requires key format over pk columns');

Try / catch

try { await createSink(cfg); } catch (e) { if (/Cannot find 'key format'/.test(String(e))) { cfg['key format'] = pkTemplate(pkColumns); await createSink(cfg); } else throw e; }

Prevention

When it happens

Trigger: Create a Redis stream sink with `value format` set but no `key format` option; primary key columns then have no way to be encoded into the entry key.

Common situations: Users assume the fixed `stream` name serves as the key and skip `key format`; configs copied from pubsub/string examples that don't need `key format`; misspelled option keys.

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/227abf71645b85cb. Report an issue: GitHub.

Appendix: source

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

                            "Please specific either `{STREAM}` or `{STREAM_COLUMN}`. They are mutually exclusive options."
                        )));
                    }

                    if let Some(stream_column) = stream_column
                        && let Some(stream_column_type) = all_map.get(stream_column)
                        && (stream_column_type != &DataType::Varchar)
                    {
                        return Err(SinkError::Config(anyhow!(
                            "`{STREAM_COLUMN}` must be set to `varchar`"
                        )));
                    }

                    let value_format =
                        self.format_desc.options.get(VALUE_FORMAT).ok_or_else(|| {
                            SinkError::Config(anyhow!("Cannot find `{VALUE_FORMAT}`"))
                        })?;
                    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)?;
                    TemplateStringEncoder::check_string_format(value_format, &all_map)?;
                }
                _ => {
                    return Err(SinkError::Config(anyhow!(
                        "`{REDIS_VALUE_TYPE}` must be set to `{REDIS_VALUE_TYPE_STRING}` or `{REDIS_VALUE_TYPE_GEO}` or `{REDIS_VALUE_TYPE_PUBSUB}` or `{REDIS_VALUE_TYPE_STREAM}`"
                    )));
                }
            }
        }
        self.config.common.build_conn_and_pipe().await?;
        Ok(())
    }
}

View on GitHub (pinned to 6469eb736d)