GoogleContainerTools/jib · error · IllegalArgumentException
Platform must be of form os/architecture.
Error message
Platform must be of form os/architecture.
What it means
JibPluginConfiguration.PlatformParameters.of parses a platform string expected as 'os/architecture' (regex ([^/ ]+)/([^/ ]+)) and throws IllegalArgumentException when the string doesn't match. This allows the shorthand <platforms>string</platforms> form to be converted into os/architecture pairs.
Source
Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/JibPluginConfiguration.java:144
this.mode = mode;
}
Optional<String> getFile() {
return Optional.ofNullable(file);
}
Optional<String> getMode() {
return Optional.ofNullable(mode);
}
}
/** Configuration for {@code platform} parameter. */
public static class PlatformParameters implements PlatformConfiguration {
private static PlatformParameters of(String osArchitecture) {
Matcher matcher = Pattern.compile("([^/ ]+)/([^/ ]+)").matcher(osArchitecture);
if (!matcher.matches()) {
throw new IllegalArgumentException("Platform must be of form os/architecture.");
}
PlatformParameters platformParameters = new PlatformParameters();
platformParameters.os = matcher.group(1);
platformParameters.architecture = matcher.group(2);
return platformParameters;
}
@Nullable @Parameter private String os;
@Nullable @Parameter private String architecture;
@Override
public Optional<String> getOsName() {
return Optional.ofNullable(os);
}
@Override
public Optional<String> getArchitectureName() {
return Optional.ofNullable(architecture);View on GitHub (pinned to fb949e2676)
Solutions
- Write the platform as exactly os/architecture, e.g. linux/amd64 or linux/arm64.
- Remove spaces from either part; use a dash or proper architecture name (e.g. linux/arm64, not linux/arm 64).
- For variant-specific images (e.g. arm/v7), use the expanded form <platform><os>linux</os><architecture>arm</architecture><variant>v7</variant></platform> instead of the shorthand string.
- If the platform string comes from a property, verify its resolved value contains exactly one '/' and no whitespace.
Example fix
<!-- before --> <platform>linux/arm64/v8</platform> <!-- after --> <platform><os>linux</os><architecture>arm64</architecture></platform>
Defensive patterns
Strategy: validation
Validate before calling
// platform string must contain exactly one '/' and no whitespace
if (!platform.matches("[^/ ]+/[^/ ]+")) {
throw new IllegalArgumentException("platform must be os/architecture: " + platform);
} Prevention
- Use the exact os/architecture shorthand (linux/amd64, linux/arm64).
- For variants, use the nested <platform><os>/<architecture>/<variant> XML form.
- Never embed spaces in platform strings.
- Validate property-driven platform values in CI before the build.
When it happens
Trigger: Configuring <from><platforms><platform>linux</platform></platforms> (no slash), 'linux/arm 64' (contains a space), 'linux/arm64/v8' (extra segment — the regex allows '/' only once because groups exclude spaces but not slashes... in practice an extra slash fails matching), or an empty platform string.
Common situations: Users copy an OCI platform string like linux/arm64/v8 or write only the architecture, or include a space in variant names.
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
- <from><platforms> contains a platform configuration that is
- <from><platforms> contains a platform configuration that is
- ${source} has empty tag
- from.platforms contains a platform configuration that is mis
- Platform must be of form os/architecture.
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/76db583f84b52814.
Report an issue: GitHub.