{"record":{"id":"9e507ef4d879e5ab","repo":"risingwavelabs/risingwave","slug":"expect-map","errorCode":null,"errorMessage":"expect map(...,...)","messagePattern":"expect map\\(\\.\\.\\.,\\.\\.\\.\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/common/src/types/map_type.rs","lineNumber":148,"sourceCode":"            | DataType::Serial\n            | DataType::Int256\n            | DataType::Vector(_)\n            | DataType::Map(_) => false,\n        };\n        if !ok {\n            Err(format!(\"invalid map key type: {data_type}\"))\n        } else {\n            Ok(())\n        }\n    }\n}\n\nimpl FromStr for MapType {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        if !(s.starts_with(\"map(\") && s.ends_with(')')) {\n            return Err(anyhow::anyhow!(\"expect map(...,...)\"));\n        };\n        if let Some((key, value)) = s[4..s.len() - 1].split(',').collect_tuple() {\n            let key = key.parse().context(\"failed to parse map key type\")?;\n            let value = value.parse().context(\"failed to parse map value type\")?;\n            MapType::try_from_kv(key, value).map_err(|e| anyhow::anyhow!(e))\n        } else {\n            Err(anyhow::anyhow!(\"expect map(...,...)\"))\n        }\n    }\n}\n\nimpl std::fmt::Display for MapType {\n    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {\n        write!(f, \"map({},{})\", self.key(), self.value())\n    }\n}\n","sourceCodeStart":130,"sourceCodeEnd":165,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/common/src/types/map_type.rs#L130-L165","documentation":"MapType::from_str parses a textual type name like `map(int,int32)` into a MapType. The parser first verifies the string starts with `map(` and ends with `)`. If not, it throws this error because the input is not syntactically a map type string.","triggerScenarios":"Calling `\"map_int\".parse::<MapType>()`, `MapType::from_str`, or deserializing a type name from config/catalog DDL where the string is missing the `map(` prefix or closing `)`.","commonSituations":"Hand-written SQL type strings in migrations or config (e.g. `MAP<INT,INT>` instead of `map(int,int)`), truncated type names read from external catalogs, or typos like `Map(` with wrong casing.","solutions":["Ensure the string starts with `map(` and ends with `)`, e.g. `map(varchar,int)`","Trim whitespace and strip any generic-style angle brackets (`MAP<K,V>`) before parsing","If the string came from a config or catalog, correct the stored type name"],"exampleFix":"// before\nlet ty: MapType = \"map<int,int>\".parse()?;\n// after\nlet ty: MapType = \"map(int,int)\".parse()?;","handlingStrategy":"validation","validationCode":"fn is_map_type_string(s: &str) -> bool {\n    let s = s.trim();\n    s.starts_with(\"map(\") && s.ends_with(')')\n}","typeGuard":"fn looks_like_map_type(s: &str) -> bool {\n    let s = s.trim();\n    s.to_ascii_lowercase().starts_with(\"map(\") && s.ends_with(')')\n}","tryCatchPattern":"match s.parse::<MapType>() {\n    Ok(t) => t,\n    Err(e) => { log::warn!(\"bad map type {s}: {e}\"); MapType::try_from_kv(key, value)? }\n}","preventionTips":["Always emit map types via MapType's Display instead of hand-writing strings","Normalize MAP<K,V> style names to map(K,V) before parsing","Trim and lowercase input type strings"],"tags":["rust","type-parsing","map-type"],"backgroundTag":"invalid-argument-format","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}