risingwavelabs/risingwave · error
error parsing with props json
Error message
error parsing with props json
What it means
In risectl's validate_source, the `--props` argument is parsed with serde_json::from_str and .expect panics with this message when the argument is not valid JSON (e.g. missing quotes around keys/values). It is a CLI-input misuse failure, not a server error: the with-properties must be passed as a JSON object string.
Source
Thrown at src/ctl/src/cmd_impl/meta/connection.rs:56
),
Some(Info::ConnectionParams(params)) => {
format!(
"CONNECTION_PARAMS_{}: {}",
params.get_connection_type().unwrap().as_str_name(),
serde_json::to_string(¶ms.get_properties()).unwrap()
)
}
None => "None".to_owned(),
}
);
}
Ok(())
}
pub async fn validate_source(context: &CtlContext, props: String) -> anyhow::Result<()> {
let with_props: HashMap<String, String> =
serde_json::from_str::<HashMap<String, Value>>(props.as_str())
.expect("error parsing with props json")
.into_iter()
.map(|(key, val)| match val {
Value::String(s) => (key, s),
_ => (key, val.to_string()),
})
.collect();
let source_type = match with_props
.get("connector")
.expect("missing 'connector' in with clause")
.as_str()
{
"kafka" => Ok(SourceType::Kafka),
_ => Err(anyhow!(
"unsupported source type, only kafka sources are supported"
)),
}?;
let meta_client = context.meta_client().await?;
let resp = meta_clientView on GitHub (pinned to 6469eb736d)
Solutions
- Validate the JSON with a linter before passing it, e.g. props='{"url":"...","aws.region":"us-east-1"}'
- Wrap the whole JSON in single quotes in the shell so inner double quotes survive
- Use a file or heredoc to pass complex props instead of inline strings
Example fix
// before
rw meta validate-source --props '{url: "kafka://..."}'
// after
rw meta validate-source --props '{"url": "kafka://..."}' Defensive patterns
Strategy: validation
Validate before calling
let with_props: HashMap<String, Value> = serde_json::from_str(&props)
.unwrap_or_else(|e| panic!("invalid props JSON: {e}")); Try / catch
let parsed: Result<HashMap<String, Value>, _> = serde_json::from_str(&props);
if let Err(e) = parsed {
eprintln!("props must be a valid JSON object: {e}");
return;
} Prevention
- Validate JSON with a linter before passing on the CLI
- Single-quote the whole JSON blob in shell to preserve double quotes
- Keep a template of correctly formatted connector props
When it happens
Trigger: Calling `rw meta validate-source` where the with-props argument is not valid JSON — unquoted keys, single quotes, trailing commas, or a non-object value like a bare string.
Common situations: Hand-writing connector properties on the CLI without proper JSON quoting; shell stripping quotes (use single-quoted shell strings); generating props from config with the wrong serializer.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
Related errors
- schema from {url} not valid JSON
- cannot decode user key {} into raw bytes
- failed to parse request body
- Field '{}' not found in secret
- Can't cast string to date (expected format is YYYY-MM-DD)
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/fdd791e3306ea27c.
Report an issue: GitHub.