{"record":{"id":"dccc2c5a65abd56a","repo":"apache/flink","slug":"map-item-is-not-a-key-value-pair-missing","errorCode":null,"errorMessage":"Map item is not a key-value pair (missing ':'?)","messagePattern":"Map item is not a key-value pair \\(missing ':'\\?\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/configuration/ConfigurationUtils.java","lineNumber":463,"sourceCode":"                Map<Object, Object> map = YamlParserUtils.convertToObject(o.toString(), Map.class);\n                return convertToStringMap(map);\n            } catch (Exception e) {\n                // Fallback to legacy pattern\n                return convertToPropertiesWithLegacyPattern(o);\n            }\n        }\n    }\n\n    @Nonnull\n    private static Map<String, String> convertToPropertiesWithLegacyPattern(Object o) {\n        List<String> listOfRawProperties =\n                StructuredOptionsSplitter.splitEscaped(o.toString(), ',');\n        return listOfRawProperties.stream()\n                .map(s -> StructuredOptionsSplitter.splitEscaped(s, ':'))\n                .peek(\n                        pair -> {\n                            if (pair.size() != 2) {\n                                throw new IllegalArgumentException(\n                                        \"Map item is not a key-value pair (missing ':'?)\");\n                            }\n                        })\n                .collect(Collectors.toMap(a -> a.get(0), a -> a.get(1)));\n    }\n\n    private static Map<String, String> convertToStringMap(Map<Object, Object> map) {\n        return map.entrySet().stream()\n                .collect(\n                        Collectors.toMap(\n                                entry -> convertToString(entry.getKey()),\n                                entry -> convertToString(entry.getValue())));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public static <E extends Enum<?>> E convertToEnum(Object o, Class<E> clazz) {\n        if (o.getClass().equals(clazz)) {\n            return (E) o;","sourceCodeStart":445,"sourceCodeEnd":481,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/configuration/ConfigurationUtils.java#L445-L481","documentation":"Thrown when parsing a Map-type config value using the legacy comma/colon-delimited pattern and an entry does not split into exactly two parts on ':'. Each comma-separated item must be 'key:value'. This path is the fallback used when the value is not already a Map object and cannot be parsed as inline YAML.","triggerScenarios":"Setting a Map<String,String> ConfigOption via a -D flag or flink-conf.yaml with a value like 'a,b' (no colon) or 'a:b:c' (too many colons). The legacy parser is reached when YAML map parsing fails and the raw string is split by StructuredOptionsSplitter on ',' then ':'.","commonSituations":"Writing map config values as plain comma-separated strings without key:value structure. Accidentally using '=' instead of ':'. Forgetting the colon on a single entry in a multi-entry map.","solutions":["Format each map entry as key:value separated by commas, e.g. key1:val1,key2:val2.","Use proper YAML inline-map syntax (curly braces) in flink-conf.yaml: my.map: {key1: val1, key2: val2}.","Escape any literal colon in a value by quoting the value."],"exampleFix":"# before\nmy.map: a,b\n\n# after\nmy.map: key1:val1,key2:val2","handlingStrategy":"validation","validationCode":"String raw = \"key1:val1,key2:val2\";\nfor (String entry : raw.split(\",\")) {\n    if (entry.split(\":\", -1).length != 2) {\n        throw new IllegalArgumentException(\"Bad map entry: \" + entry);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    config.set(mapOption, rawValue);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"key-value pair\")) { /* fix the value */ }\n}","preventionTips":["Always format map values as key:value pairs separated by commas.","Use YAML inline map syntax ({k: v}) for clarity.","Escape literal colons in values by quoting."],"tags":["configuration","map-parsing","legacy"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}