{"record":{"id":"fdd791e3306ea27c","repo":"risingwavelabs/risingwave","slug":"error-parsing-with-props-json","errorCode":null,"errorMessage":"error parsing with props json","messagePattern":"error parsing with props json","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ctl/src/cmd_impl/meta/connection.rs","lineNumber":56,"sourceCode":"                ),\n                Some(Info::ConnectionParams(params)) => {\n                    format!(\n                        \"CONNECTION_PARAMS_{}: {}\",\n                        params.get_connection_type().unwrap().as_str_name(),\n                        serde_json::to_string(&params.get_properties()).unwrap()\n                    )\n                }\n                None => \"None\".to_owned(),\n            }\n        );\n    }\n    Ok(())\n}\n\npub async fn validate_source(context: &CtlContext, props: String) -> anyhow::Result<()> {\n    let with_props: HashMap<String, String> =\n        serde_json::from_str::<HashMap<String, Value>>(props.as_str())\n            .expect(\"error parsing with props json\")\n            .into_iter()\n            .map(|(key, val)| match val {\n                Value::String(s) => (key, s),\n                _ => (key, val.to_string()),\n            })\n            .collect();\n    let source_type = match with_props\n        .get(\"connector\")\n        .expect(\"missing 'connector' in with clause\")\n        .as_str()\n    {\n        \"kafka\" => Ok(SourceType::Kafka),\n        _ => Err(anyhow!(\n            \"unsupported source type, only kafka sources are supported\"\n        )),\n    }?;\n    let meta_client = context.meta_client().await?;\n    let resp = meta_client","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/ctl/src/cmd_impl/meta/connection.rs#L38-L74","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nrw meta validate-source --props '{url: \"kafka://...\"}'\n// after\nrw meta validate-source --props '{\"url\": \"kafka://...\"}'","handlingStrategy":"validation","validationCode":"let with_props: HashMap<String, Value> = serde_json::from_str(&props)\n    .unwrap_or_else(|e| panic!(\"invalid props JSON: {e}\"));","typeGuard":null,"tryCatchPattern":"let parsed: Result<HashMap<String, Value>, _> = serde_json::from_str(&props);\nif let Err(e) = parsed {\n    eprintln!(\"props must be a valid JSON object: {e}\");\n    return;\n}","preventionTips":["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"],"tags":["json","cli","parsing","panic"],"backgroundTag":"json-parse-error","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}