risingwavelabs/risingwave · error · SinkError::Config
`{}` must be {}, or {}
Error message
`{}` must be {}, or {} What it means
`BigQueryConfig::from_btreemap` validates that the `type` sink property is one of the allowed values ('append-only' or 'upsert'). Any other value — even a misspelling or different casing — fails serde parsing or the explicit check, and this error message is returned naming the three acceptable tokens.
Source
Thrown at src/connector/src/sink/big_query.rs:284
}
crate::impl_sink_unknown_fields!(BigQueryConfig);
impl EnforceSecret for BigQueryConfig {
fn enforce_one(prop: &str) -> crate::error::ConnectorResult<()> {
BigQueryCommon::enforce_one(prop)?;
AwsAuthProps::enforce_one(prop)?;
Ok(())
}
}
impl BigQueryConfig {
pub fn from_btreemap(properties: BTreeMap<String, String>) -> Result<Self> {
let config =
serde_json::from_value::<BigQueryConfig>(serde_json::to_value(properties).unwrap())
.map_err(|e| SinkError::Config(anyhow!(e)))?;
if config.r#type != SINK_TYPE_APPEND_ONLY && config.r#type != SINK_TYPE_UPSERT {
return Err(SinkError::Config(anyhow!(
"`{}` must be {}, or {}",
SINK_TYPE_OPTION,
SINK_TYPE_APPEND_ONLY,
SINK_TYPE_UPSERT
)));
}
Ok(config)
}
}
#[derive(Debug)]
pub struct BigQuerySink {
pub config: BigQueryConfig,
schema: Schema,
pk_indices: Vec<usize>,
is_append_only: bool,
}
View on GitHub (pinned to 6469eb736d)
Solutions
- Set `type = 'append-only'` for insert-only sinks
- Set `type = 'upsert'` if the sink must handle updates/deletes
- Re-create the sink after fixing the WITH clause
Example fix
// before WITH (connector = 'bigquery', type = 'insert') // after WITH (connector = 'bigquery', type = 'append-only')
Defensive patterns
Strategy: validation
Validate before calling
const t = props.get("type");
if (t !== "append-only" && t !== "upsert") throw new Error(`type must be 'append-only' or 'upsert', got ${t}`); Try / catch
match BigQueryConfig::from_btreemap(props) {
Err(e) if e.to_string().contains("must be append-only, or upsert") => {
eprintln!("fix the `type` WITH option");
}
_ => {}
} Prevention
- Use exactly 'append-only' or 'upsert', lowercase with hyphen
- Check connector docs for valid sink type tokens
- Validate the WITH clause with a lint before CREATE SINK
When it happens
Trigger: Creating a BigQuery sink with `type = 'append'`, `type = 'Append_Only'`, `type = 'insert'`, or any value other than exactly 'append-only' or 'upsert'.
Common situations: Copy-pasting a WITH clause from a different connector that uses different type tokens; typos; assuming case-insensitivity.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- unrecognized configs: {:?}
- Invalid value for Bounded strategy: must be positive integer
- Invalid value for Ratio strategy: must be between 0.0 and 1.
- NATS connect mode `user_and_password` requires both `user` a
- NATS connect mode `credential` requires both `nkey` and `jwt
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/e2a66e27bf80a254.
Report an issue: GitHub.