risingwavelabs/risingwave · error · SinkError

`{CHANNEL}` and `{CHANNEL_COLUMN}` only one can be set

Error message

`{CHANNEL}` and `{CHANNEL_COLUMN}` only one can be set

What it means

For `redis_value_type = 'pubsub'` sinks with a primary key, the Redis channel target must be specified via exactly one of the two mutually exclusive options `channel` (a static channel name) or `channel_column` (a column whose value is the channel). Setting neither, or setting both, makes the sink build fail with this SinkError::Config.

Source

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

                }
                None => {
                    let lat_name = b.format_desc.options.get(LAT_NAME).ok_or_else(|| {
                        SinkError::Config(anyhow!("Cannot find `{LAT_NAME}`, please set it."))
                    })?;
                    let lon_name = b.format_desc.options.get(LON_NAME).ok_or_else(|| {
                        SinkError::Config(anyhow!("Cannot find `{LON_NAME}`,please set it."))
                    })?;
                    TemplateEncoder::new_geo_value(b.schema, pk_indices, lat_name, lon_name)
                }
            },
            REDIS_VALUE_TYPE_PUBSUB => match pk_indices {
                Some(_) => {
                    let channel = b.format_desc.options.get(CHANNEL).cloned();
                    let channel_column = b.format_desc.options.get(CHANNEL_COLUMN).cloned();
                    if (channel.is_none() && channel_column.is_none())
                        || (channel.is_some() && channel_column.is_some())
                    {
                        return Err(SinkError::Config(anyhow!(
                            "`{CHANNEL}` and `{CHANNEL_COLUMN}` only one can be set"
                        )));
                    }
                    TemplateEncoder::new_pubsub_stream_key(
                        b.schema,
                        pk_indices,
                        channel,
                        channel_column,
                    )
                }
                None => {
                    let template = b.format_desc.options.get(VALUE_FORMAT).ok_or_else(|| {
                        SinkError::Config(anyhow!("Cannot find '{VALUE_FORMAT}',please set it."))
                    })?;
                    Ok(TemplateEncoder::new_string(
                        b.schema,
                        pk_indices,
                        template.clone(),

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Choose one channel strategy: either a fixed `channel = 'my-channel'` or `channel_column = 'channel_col'`, and delete the other option.
  2. If you want dynamic per-row channels, keep only `channel_column`; for a fixed channel keep only `channel`.
  3. Re-run the CREATE SINK statement after cleaning up the WITH options.

Example fix

// before
WITH (redis_value_type='pubsub', channel='alerts', channel_column='ch');
// after
WITH (redis_value_type='pubsub', channel_column='ch');  -- or keep channel='alerts' only
Defensive patterns

Strategy: validation

Validate before calling

if value_type == "pubsub" {
    let c = with_options.contains_key("channel");
    let cc = with_options.contains_key("channel_column");
    if c == cc {
        return Err("Set exactly one of `channel` or `channel_column`".into());
    }
}

Try / catch

match result {
    Err(e) if e.to_string().contains("only one can be set") => {
        eprintln!("Fix channel options (keep exactly one of channel/channel_column): {}", e);
    }
    other => other?,
}

Prevention

When it happens

Trigger: Creating a Redis pubsub sink with a primary key where the WITH options contain both `channel` and `channel_column`, or neither of them.

Common situations: Users add `channel` while an earlier `channel_column` option is still present, or they assume a default channel exists and provide neither option.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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