GoogleContainerTools/jib · error · IllegalArgumentException
'${entry}' is not a valid key-value pair
Error message
'${entry}' is not a valid key-value pair What it means
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.
Source
Thrown at jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/ConfigurationPropertyValidator.java:146
}
}
/**
* Parses a string in the form of "key1=value1,key2=value2,..." into a map.
*
* @param property the map string to parse, with entries separated by "," and key-value pairs
* separated by "="
* @return the map of parsed values
*/
public static Map<String, String> parseMapProperty(String property) {
Map<String, String> result = new LinkedHashMap<>(); // LinkedHashMap to keep insertion order
// Split on non-escaped commas
List<String> entries = parseListProperty(property);
for (String entry : entries) {
Matcher matcher = KEY_VALUE_PATTERN.matcher(entry);
if (!matcher.matches()) {
throw new IllegalArgumentException("'" + entry + "' is not a valid key-value pair");
}
result.put(matcher.group("name"), matcher.group("value"));
}
return result;
}
/**
* Parses a comma-separated string into a list. Ignores commas escaped with "\".
*
* @param property the comma-separated string
* @return the list of parsed values
*/
public static List<String> parseListProperty(String property) {
List<String> items = new ArrayList<>();
StringBuilder token = new StringBuilder();
for (int i = 0; i < property.length(); i++) {
if (property.charAt(i) == ',') {
// Split on non-escaped commaView on GitHub (pinned to fb949e2676)
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.
Example fix
// before mvn jib:build -Djib.container.environment=DEBUG // after mvn jib:build -Djib.container.environment=DEBUG=1
Defensive patterns
Strategy: validation
Validate before calling
// validate every entry has a key=value form before invoking Jib
const entries = prop.split(/(?<!\\),/);
const bad = entries.filter(e => !/^[^=]+=/.test(e));
if (bad.length) throw new Error('Not key=value: ' + bad.join(', ')); Try / catch
try { jibBuild() } catch (IllegalArgumentException e) {
if (e.message.contains('is not a valid key-value pair')) {
// fix the named entry in the message: add '=value' or escape commas
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- <container><appRoot> is not an absolute Unix-style path: ${e
- invalid value for <containerizingMode>: ${ex.getInvalidConta
- <container><appRoot> is not an absolute Unix-style path: <in
- invalid value for <containerizingMode>: <invalidContainerizi
- <container><workingDirectory> is not an absolute Unix-style
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/948d2203942d7e01.
Report an issue: GitHub.