risingwavelabs/risingwave · error · SinkError::Config

SinkError::Config(anyhow!(e))

Error message

SinkError::Config(anyhow!(e))

What it means

`RedShiftConfig::from_btreemap` deserializes the sink's user-supplied property map into a `RedShiftConfig` via serde_json; any missing required field or invalid value produces a serde error that is wrapped as SinkError::Config. It means the Redshift sink properties are malformed.

Source

Thrown at src/connector/src/sink/snowflake_redshift/redshift.rs:152

    3600 // Default to 1 hour
}

fn default_intermediate_interval_schedule() -> u64 {
    1800 // Default to 0.5 hour
}

fn default_batch_insert_rows() -> u32 {
    4096 // Default batch size
}

fn default_with_s3() -> bool {
    true
}

impl RedShiftConfig {
    pub fn from_btreemap(properties: BTreeMap<String, String>) -> Result<Self> {
        serde_json::from_value::<RedShiftConfig>(serde_json::to_value(properties).unwrap())
            .map_err(|e| SinkError::Config(anyhow!(e)))
    }

    pub fn build_client(&self) -> Result<JdbcJniClient> {
        let mut jdbc_url = self.jdbc_url.clone();
        if let Some(username) = &self.username {
            jdbc_url = format!("{}?user={}", jdbc_url, username);
        }
        if let Some(password) = &self.password {
            jdbc_url = format!("{}&password={}", jdbc_url, password);
        }
        JdbcJniClient::new(jdbc_url)
    }
}

#[derive(Debug)]
pub struct RedshiftSink {
    config: RedShiftConfig,
    param: SinkParam,

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Check the error text from serde naming the missing/invalid field and fix the CREATE SINK properties
  2. Ensure all required Redshift options are provided (jdbc_url, table, schema, region, s3 settings as applicable)
  3. Validate property names against the Redshift sink documentation before creating the sink

Example fix

// before
WITH ( connector = 'redshift', tabel = 'my_table' )
-- after
WITH ( connector = 'redshift', table = 'my_table', jdbc_url = '...', ... )
Defensive patterns

Strategy: validation

Validate before calling

// validate required redshift properties before creating the sink
fn validate_redshift_props(props: &BTreeMap<String, String>) -> Result<(), String> {
    for k in ["jdbc_url", "table", "schema"] {
        if !props.contains_key(k) { return Err(format!("missing required property: {}", k)); }
    }
    Ok(())
}

Try / catch

match RedShiftConfig::from_btreemap(props) {
    Ok(cfg) => cfg,
    Err(e) if matches!(&e, SinkError::Config(_)) => { log::error!("invalid redshift sink config: {}", e); return Err(e); }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Creating a Redshift sink whose properties BTreeMap is missing required keys (e.g. jdbc-url, table, arn) or has wrong-typed values, so `serde_json::from_value` fails.

Common situations: Typos in CREATE SINK property names; missing mandatory fields in the connector WITH clause; values that don't deserialize into the configured Rust types.

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