{"record":{"id":"66744a2dd1b71d85","repo":"GoogleContainerTools/jib","slug":"invalid-base-image-reference-buildplan-getbasei-66744a","errorCode":null,"errorMessage":"invalid base image reference: ${buildPlan.getBaseImage()}","messagePattern":"invalid base image reference: (.+?)","errorType":"validation","errorClass":"JibPluginExtensionException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenProjectProperties.java","lineNumber":631,"sourceCode":"    // Extensions might support both approaches (injection and JDK service loader) at the same\n    // time for compatibility reasons.\n    List<JibMavenPluginExtension<?>> loadedExtensions = new ArrayList<>(injectedExtensions);\n    loadedExtensions.addAll(extensionLoader.get());\n    JibMavenPluginExtension<?> extension = null;\n    ContainerBuildPlan buildPlan = jibContainerBuilder.toContainerBuildPlan();\n    try {\n      for (ExtensionConfiguration config : extensionConfigs) {\n        extension = findConfiguredExtension(loadedExtensions, config);\n\n        log(LogEvent.lifecycle(\"Running extension: \" + config.getExtensionClass()));\n        buildPlan =\n            runPluginExtension(extension.getExtraConfigType(), extension, config, buildPlan);\n        ImageReference.parse(buildPlan.getBaseImage()); // to validate image reference\n      }\n      return jibContainerBuilder.applyContainerBuildPlan(buildPlan);\n\n    } catch (InvalidImageReferenceException ex) {\n      throw new JibPluginExtensionException(\n          Verify.verifyNotNull(extension).getClass(),\n          \"invalid base image reference: \" + buildPlan.getBaseImage(),\n          ex);\n    }\n  }\n\n  // Unchecked casting: \"getExtraConfiguration()\" (Optional<Object>) to Object<T> and \"extension\"\n  // (JibMavenPluginExtension<?>) to JibMavenPluginExtension<T> where T is the extension-defined\n  // config type (as requested by \"JibMavenPluginExtension.getExtraConfigType()\").\n  @SuppressWarnings({\"unchecked\"})\n  private <T> ContainerBuildPlan runPluginExtension(\n      Optional<Class<T>> extraConfigType,\n      JibMavenPluginExtension<?> extension,\n      ExtensionConfiguration config,\n      ContainerBuildPlan buildPlan)\n      throws JibPluginExtensionException {\n    Optional<T> extraConfig = Optional.empty();\n    Optional<Object> configs = config.getExtraConfiguration();","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenProjectProperties.java#L613-L649","documentation":"During Jib Maven plugin extension processing, the base image string produced by a plugin extension's build plan could not be parsed as a valid container image reference. runPluginExtensions validates the extension-modified plan's base image with ImageReference.parse and wraps the resulting InvalidImageReferenceException in a JibPluginExtensionException.","triggerScenarios":"A Jib plugin extension (run via <pluginExtensions> configuration) returns a ContainerBuildPlan whose baseImage is null, empty, malformed, or contains invalid characters/registry syntax, causing ImageReference.parse to throw.","commonSituations":"Custom extension code sets the base image from a property or env var that is unset/empty; extension builds the image string by concatenation producing 'registry/image:tag:' style malformations; port or digest formatting mistakes in generated references.","solutions":["Log/print buildPlan.getBaseImage() in your extension to see the actual invalid value and fix the string generation.","Validate the base image with ImageReference.parse() inside your extension before returning the build plan to fail fast with a clearer message.","Ensure any properties/env vars feeding the base image name are set and non-empty at build time.","Check that registry, repository, tag, and digest components conform to Docker reference grammar (no invalid characters, port syntax, empty tags)."],"exampleFix":"// before (in extension)\nString base = System.getProperty(\"base.image\");\nplan.setToBaseImage(base);\n\n// after\nString base = Objects.requireNonNullElse(System.getProperty(\"base.image\"), \"eclipse-temurin:17\");\nImageReference.parse(base); // fail fast with clear message\nplan.setToBaseImage(base);","handlingStrategy":"validation","validationCode":"// In your extension, before returning the build plan\nimport com.google.cloud.tools.jib.api.ImageReference;\nString base = buildPlan.getBaseImage();\nImageReference.parse(base); // throws InvalidImageReferenceException early with clear context\nif (base == null || base.isBlank()) throw new IllegalStateException(\"base image must be set\");","typeGuard":"boolean isValidImageRef(String s) {\n  return s != null && s.matches(\"[a-zA-Z0-9][a-zA-Z0-9._-]*(?::[0-9]+)?(?:/[a-zA-Z0-9._/-]+)*(?::[a-zA-Z0-9._-]+)?(?:@[a-zA-Z0-9+:._-]+)?\");\n}","tryCatchPattern":"try {\n  // run jib build with extensions\n} catch (JibPluginExtensionException e) {\n  if (e.getMessage().startsWith(\"invalid base image reference\")) {\n    // inspect extension logic producing the base image\n  }\n  throw e;\n}","preventionTips":["Validate base image strings with ImageReference.parse inside extensions before returning plans.","Never build base image strings from possibly-empty properties/env vars without defaults.","Use ImageReference.of(...) or ImageReference.parse(...) APIs instead of raw string concatenation.","Add a unit test for your extension that asserts the produced plan's base image parses."],"tags":["jib","maven-plugin-extension","image-reference"],"backgroundTag":"invalid-url-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"}