{"record":{"id":"76db583f84b52814","repo":"GoogleContainerTools/jib","slug":"platform-must-be-of-form-os-architecture-76db58","errorCode":null,"errorMessage":"Platform must be of form os/architecture.","messagePattern":"Platform must be of form os/architecture\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/JibPluginConfiguration.java","lineNumber":144,"sourceCode":"      this.mode = mode;\n    }\n\n    Optional<String> getFile() {\n      return Optional.ofNullable(file);\n    }\n\n    Optional<String> getMode() {\n      return Optional.ofNullable(mode);\n    }\n  }\n\n  /** Configuration for {@code platform} parameter. */\n  public static class PlatformParameters implements PlatformConfiguration {\n\n    private static PlatformParameters of(String osArchitecture) {\n      Matcher matcher = Pattern.compile(\"([^/ ]+)/([^/ ]+)\").matcher(osArchitecture);\n      if (!matcher.matches()) {\n        throw new IllegalArgumentException(\"Platform must be of form os/architecture.\");\n      }\n      PlatformParameters platformParameters = new PlatformParameters();\n      platformParameters.os = matcher.group(1);\n      platformParameters.architecture = matcher.group(2);\n      return platformParameters;\n    }\n\n    @Nullable @Parameter private String os;\n    @Nullable @Parameter private String architecture;\n\n    @Override\n    public Optional<String> getOsName() {\n      return Optional.ofNullable(os);\n    }\n\n    @Override\n    public Optional<String> getArchitectureName() {\n      return Optional.ofNullable(architecture);","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/JibPluginConfiguration.java#L126-L162","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users copy an OCI platform string like linux/arm64/v8 or write only the architecture, or include a space in variant names.","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."],"exampleFix":"<!-- before -->\n<platform>linux/arm64/v8</platform>\n<!-- after -->\n<platform><os>linux</os><architecture>arm64</architecture></platform>","handlingStrategy":"validation","validationCode":"// platform string must contain exactly one '/' and no whitespace\nif (!platform.matches(\"[^/ ]+/[^/ ]+\")) {\n  throw new IllegalArgumentException(\"platform must be os/architecture: \" + platform);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["maven","jib","platform","configuration","validation"],"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-14T00:17:10.932Z"}