{"record":{"id":"0d7c8061a52054f1","repo":"GoogleContainerTools/jib","slug":"helpfulsuggestions-forinvalidimagereference-ex-g-0d7c80","errorCode":null,"errorMessage":"HelpfulSuggestions.forInvalidImageReference(${ex.getInvalidReference()})","messagePattern":"HelpfulSuggestions\\.forInvalidImageReference\\((.+?)\\)","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildTarTask.java","lineNumber":199,"sourceCode":"              + \"DateTimeFormatter.ISO_DATE_TIME) or a special keyword (\\\"EPOCH\\\", \"\n              + \"\\\"USE_CURRENT_TIMESTAMP\\\"): \"\n              + ex.getInvalidCreationTime(),\n          ex);\n\n    } catch (JibPluginExtensionException ex) {\n      String extensionName = ex.getExtensionClass().getName();\n      throw new GradleException(\n          \"error running extension '\" + extensionName + \"': \" + ex.getMessage(), ex);\n\n    } catch (IncompatibleBaseImageJavaVersionException ex) {\n      throw new GradleException(\n          HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForGradle(\n              ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),\n          ex);\n\n    } catch (InvalidImageReferenceException ex) {\n      throw new GradleException(\n          HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);\n\n    } catch (ExtraDirectoryNotFoundException ex) {\n      throw new GradleException(\n          \"extraDirectories.paths contain \\\"from\\\" directory that doesn't exist locally: \"\n              + ex.getPath(),\n          ex);\n    } finally {\n      tempDirectoryProvider.close();\n      TaskCommon.finishUpdateChecker(projectProperties, updateCheckFuture);\n      projectProperties.waitForLoggingThread();\n    }\n  }\n\n  @Override\n  public BuildTarTask setJibExtension(JibExtension jibExtension) {\n    this.jibExtension = jibExtension;\n    return this;\n  }","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildTarTask.java#L181-L217","documentation":"BuildTarTask.buildTar catches InvalidImageReferenceException and wraps HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()) in a GradleException. Jib throws this when a configured image reference (base image, target image, etc.) cannot be parsed as a valid container image reference (registry/repository:tag@digest format).","triggerScenarios":"jib.from.image or jib.to.image contains illegal characters, spaces, uppercase in repository name, empty string, a tag longer than 128 chars, or malformed digest syntax, and a jib task (here jibBuildTar) attempts to parse it.","commonSituations":"Typo like 'my repo/app'; property interpolation yielding empty string ($ failing to resolve); using a tag with invalid characters; accidentally pasting a full 'docker pull' command line as the image name.","solutions":["Fix the reference format: lowercase repository, no spaces, optional registry host, tag <= 128 chars, e.g. 'gcr.io/my-project/app:1.0.0'","Check that any Gradle property interpolated into the image name actually resolves (print it in a doFirst or validate task)","Validate locally with ImageReference.parse(...) or a regex before passing dynamic values"],"exampleFix":"// before\njib.to.image = 'gcr.io/My-Project/App:latest release'\n// after\njib.to.image = 'gcr.io/my-project/app:latest-release'","handlingStrategy":"validation","validationCode":"def validRef = { s -> s ==~ /[a-z0-9]+((\\.|__|-+)[a-z0-9]+)*(\\/[^\\sA-Z]+)?(:[\\w][\\w.-]{0,127})?(@sha256:[a-f0-9]{64})?/ }\nassert validRef(jib.to.image.get()) && validRef(jib.from.image.get())","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep image names lowercase, no spaces, tags <= 128 chars","Avoid building image names by string concatenation with possibly-empty properties","Log the resolved image name during build-script configuration to catch interpolation issues early"],"tags":["jib","gradle","image-reference","configuration"],"backgroundTag":"invalid-image-reference","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"}