{"record":{"id":"e9168f0cc5169c6d","repo":"GoogleContainerTools/jib","slug":"helpfulsuggestions-forinvalidimagereference-ex-g","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/BuildImageTask.java","lineNumber":177,"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 BuildImageTask setJibExtension(JibExtension jibExtension) {\n    this.jibExtension = jibExtension;\n    return this;\n  }","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildImageTask.java#L159-L195","documentation":"Jib validates image references (jib.to.image, jib.from.image, --image flag) before any registry/network work and throws InvalidImageReferenceException when the string is not a syntactically valid image reference (bad registry, tag, or digest form). The Gradle task converts it to a GradleException with HelpfulSuggestions suggesting correct syntax, passing along the invalid reference text.","triggerScenarios":"Running gradle jib/jibBuild where jib.to.image or jib.from.image contains an invalid reference: empty string, illegal characters, missing repository name after a registry host, malformed port, or malformed digest.","commonSituations":"Typos like 'myregistry:5000/app' with bad tag syntax; unexpanded Gradle property (e.g. 'jib.to.image = \"${env.IMAGE}\"' resolving to literal text or empty); using docker-style shorthand Jib cannot parse; copy-pasting an image name with quotes/spaces.","solutions":["Correct the image reference syntax in jib.to.image / jib.from.image to a full valid form like 'registry/project/image:tag'","Check that any Gradle property or environment variable interpolated into the image value actually resolves (don't pass through unresolved placeholders)","Use the --image flag to override: gradle jib --image myregistry.example.com/project/app:1.0","Test the reference locally with 'docker pull <ref>' to confirm it is a valid, resolvable reference"],"exampleFix":"// before\njib { to { image = \"${System.getenv('IMAGE_NAME')}\" } } // IMAGE_NAME unset -> empty/invalid\n// after\njib {\n  to {\n    image = System.getenv('IMAGE_NAME') ?: 'gcr.io/my-project/my-app:latest'\n  }\n}","handlingStrategy":"validation","validationCode":"def ref = project.jib.to.image.getOrElse('')\nif (!ref || !(ref ==~ /^[a-zA-Z0-9][a-zA-Z0-9._\\-/:]*(:[a-zA-Z0-9._\\-]+)?(@sha256:[a-f0-9]{64})?$/)) {\n  throw new GradleException(\"Invalid image reference: '$ref'\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never interpolate possibly-unset env vars/properties into image names without a default","Use fully qualified references: registry/project/image:tag","Test references locally with docker pull before wiring them into Jib"],"tags":["jib","gradle","image-reference","validation"],"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-14T05:17:10.506Z"}