{"record":{"id":"948d2203942d7e01","repo":"GoogleContainerTools/jib","slug":"entry-is-not-a-valid-key-value-pair","errorCode":null,"errorMessage":"'${entry}' is not a valid key-value pair","messagePattern":"'(.+?)' is not a valid key-value pair","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/ConfigurationPropertyValidator.java","lineNumber":146,"sourceCode":"    }\n  }\n\n  /**\n   * Parses a string in the form of \"key1=value1,key2=value2,...\" into a map.\n   *\n   * @param property the map string to parse, with entries separated by \",\" and key-value pairs\n   *     separated by \"=\"\n   * @return the map of parsed values\n   */\n  public static Map<String, String> parseMapProperty(String property) {\n    Map<String, String> result = new LinkedHashMap<>(); // LinkedHashMap to keep insertion order\n\n    // Split on non-escaped commas\n    List<String> entries = parseListProperty(property);\n    for (String entry : entries) {\n      Matcher matcher = KEY_VALUE_PATTERN.matcher(entry);\n      if (!matcher.matches()) {\n        throw new IllegalArgumentException(\"'\" + entry + \"' is not a valid key-value pair\");\n      }\n      result.put(matcher.group(\"name\"), matcher.group(\"value\"));\n    }\n    return result;\n  }\n\n  /**\n   * Parses a comma-separated string into a list. Ignores commas escaped with \"\\\".\n   *\n   * @param property the comma-separated string\n   * @return the list of parsed values\n   */\n  public static List<String> parseListProperty(String property) {\n    List<String> items = new ArrayList<>();\n    StringBuilder token = new StringBuilder();\n    for (int i = 0; i < property.length(); i++) {\n      if (property.charAt(i) == ',') {\n        // Split on non-escaped comma","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/ConfigurationPropertyValidator.java#L128-L164","documentation":"ConfigurationPropertyValidator.parseMapProperty parses plugin configuration properties given as comma-separated key=value entries (e.g. jib.container.environment). Each entry must match the KEY_VALUE_PATTERN (name=value); if an entry lacks the '=' separator or is malformed, an IllegalArgumentException is thrown telling you which entry is invalid.","triggerScenarios":"Passing a map-like plugin property (e.g. `jib.container.environment=FOO` or `jib.container.labels=foo,bar=baz`) where an entry has no `name=value` form, e.g. a bare key without '=' or an empty entry from a stray comma.","commonSituations":"Maven command-line `-Djib.container.environment=DEBUG` (missing =VALUE); Gradle `jib.container.labels 'someLabel'`; a typo'd entry in pom.xml/build.gradle; commas inside values without escaping.","solutions":["Give every entry a `key=value` form: `-Djib.container.environment=DEBUG=1`.","Escape literal commas inside values with a backslash (`key=a\\,b`) or move the config to pom.xml/build.gradle where lists are structured.","Remove empty entries caused by trailing/duplicate commas.","Check the plugin docs for the exact property format before using the CLI flag form."],"exampleFix":"// before\nmvn jib:build -Djib.container.environment=DEBUG\n// after\nmvn jib:build -Djib.container.environment=DEBUG=1","handlingStrategy":"validation","validationCode":"// validate every entry has a key=value form before invoking Jib\nconst entries = prop.split(/(?<!\\\\),/);\nconst bad = entries.filter(e => !/^[^=]+=/.test(e));\nif (bad.length) throw new Error('Not key=value: ' + bad.join(', '));","typeGuard":null,"tryCatchPattern":"try { jibBuild() } catch (IllegalArgumentException e) {\n  if (e.message.contains('is not a valid key-value pair')) {\n    // fix the named entry in the message: add '=value' or escape commas\n  }\n}","preventionTips":["Always write map-style CLI props as key=value pairs","Escape literal commas in values with backslash","Prefer structured pom.xml/build.gradle config over long CLI lists","Check for trailing commas in generated property strings"],"tags":["configuration","parsing","jib","maven"],"backgroundTag":"invalid-argument-format","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}