risingwavelabs/risingwave · error · ConnectorError
Invalid field: {}, allowed fields: {:?}
Error message
Invalid field: {}, allowed fields: {:?} What it means
Strict validation of the connection properties when converting an ElasticsearchConnection into ElasticsearchOpenSearchConfig. Only `url`, `username`, and `password` are permitted; any other key in the connection's properties map causes this error, preventing silently ignored options.
Source
Thrown at src/connector/src/sink/elasticsearch_opensearch/elasticsearch_opensearch_config.rs:146
}
fn default_batch_size_kb() -> usize {
5 * 1024
}
fn default_concurrent_requests() -> usize {
1024
}
impl TryFrom<&ElasticsearchConnection> for ElasticSearchOpenSearchConfig {
type Error = ConnectorError;
fn try_from(value: &ElasticsearchConnection) -> std::result::Result<Self, Self::Error> {
let allowed_fields: HashSet<&str> = hashset!["url", "username", "password"]; // from ElasticsearchOpenSearchConfig
for k in value.0.keys() {
if !allowed_fields.contains(k.as_str()) {
return Err(ConnectorError::from(anyhow!(
"Invalid field: {}, allowed fields: {:?}",
k,
allowed_fields
)));
}
}
let config = serde_json::from_value::<ElasticSearchOpenSearchConfig>(
serde_json::to_value(value.0.clone()).unwrap(),
)
.map_err(|e| SinkError::Config(anyhow!(e)))?;
Ok(config)
}
}
impl ElasticSearchConfig {
pub fn from_btreemap(properties: BTreeMap<String, String>) -> Result<Self> {
let config = serde_json::from_value::<ElasticSearchConfig>(View on GitHub (pinned to 6469eb736d)
Solutions
- Remove unknown keys from the connection definition; keep only url/username/password.
- Move sink-specific options (index, primary_key, routing_column, delimiter) into the sink's WITH clause instead.
- Check key spelling against the allowed set {url, username, password}.
Example fix
// before CREATE CONNECTION es_conn WITH ( TYPE = ELASTICSEARCH, url = 'http://localhost:9200', index = 'my-index' ) // after CREATE CONNECTION es_conn WITH ( TYPE = ELASTICSEARCH, url = 'http://localhost:9200' ) -- put 'index' in the sink WITH clause instead
Defensive patterns
Strategy: validation
Validate before calling
-- before CREATE CONNECTION -- allowed keys are exactly: url, username, password CREATE CONNECTION es_conn WITH (TYPE = ELASTICSEARCH, url = 'http://localhost:9200');
Try / catch
match err { ConnectorError(e) if e.to_string().contains("Invalid field") => move_option_to_sink_with_clause(e), _ => return Err(err) } Prevention
- Treat the connection as transport-only config: url + credentials only.
- Put index, primary_key, routing_column, delimiter in the sink's WITH clause.
- Diff your connection DDL against the docs' allowed-field list before applying.
When it happens
Trigger: Defining an ES/OpenSearch connection (CREATE CONNECTION ... TYPE ELASTICSEARCH) whose properties include any key outside {url, username, password}, e.g. `index`, `delimiter`, or `primary_key` mistakenly placed on the connection instead of the sink.
Common situations: Copying sink-level WITH options into the connection definition; typos like `Username`; leftover options from a different connector type.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- please set the password when the username is set.
- please set the username when the password is set.
- Url::parse error: {e}
- Cannot find {}
- unrecognized configs: {:?}
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/a332210397d0bb01.
Report an issue: GitHub.