GoogleContainerTools/jib · error · MojoExecutionException
<message from InvalidImageReferenceException via HelpfulSugg
Error message
<message from InvalidImageReferenceException via HelpfulSuggestions.forInvalidImageReference>
What it means
Thrown as a MojoExecutionException from BuildTarMojo.execute when the configured image reference cannot be parsed (InvalidImageReferenceException). The message comes from HelpfulSuggestions.forInvalidImageReference and restates the invalid reference with hints about the expected format.
Source
Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildTarMojo.java:149
"<container><creationTime> should be an ISO 8601 date-time (see "
+ "DateTimeFormatter.ISO_DATE_TIME) or a special keyword (\"EPOCH\", "
+ "\"USE_CURRENT_TIMESTAMP\"): "
+ ex.getInvalidCreationTime(),
ex);
} catch (JibPluginExtensionException ex) {
String extensionName = ex.getExtensionClass().getName();
throw new MojoExecutionException(
"error running extension '" + extensionName + "': " + ex.getMessage(), ex);
} catch (IncompatibleBaseImageJavaVersionException ex) {
throw new MojoExecutionException(
HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven(
ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),
ex);
} catch (InvalidImageReferenceException ex) {
throw new MojoExecutionException(
HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);
} catch (IOException
| CacheDirectoryCreationException
| MainClassInferenceException
| InvalidGlobalConfigException ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
} catch (BuildStepsExecutionException ex) {
throw new MojoExecutionException(ex.getMessage(), ex.getCause());
} catch (ExtraDirectoryNotFoundException ex) {
throw new MojoExecutionException(
"<extraDirectories><paths> contain \"from\" directory that doesn't exist locally: "
+ ex.getPath(),
ex);
} finally {
tempDirectoryProvider.close();View on GitHub (pinned to fb949e2676)
Solutions
- Fix the image reference to a valid Docker-style reference: [registry-host[:port]/]namespace/repo[:tag][@digest], lowercase repository name.
- Remove spaces, illegal characters, or an empty tag from the reference.
- If the value comes from a property (e.g. -Dimage or CI variable), print/verify its resolved value — it may be empty or truncated.
- Use a fully qualified reference if the registry host is ambiguous, e.g. registry.example.com:5000/myapp:1.0.
Example fix
// before <to><image>My App:latest</image></to> // after <to><image>registry.example.com/myteam/my-app:latest</image></to>
Defensive patterns
Strategy: validation
Validate before calling
// regex per Docker distribution reference grammar (simplified)
java.util.regex.Pattern REF = java.util.regex.Pattern.compile(
"^(?:[a-zA-Z0-9][a-zA-Z0-9.-]*(?::[0-9]+)??/)?[a-z0-9]+(?:[._-][a-z0-9]+)*(?::[a-zA-Z0-9._-]+)?(?:@[a-f0-9]{64})?$");
if (!REF.matcher(imageRef).matches()) throw new IllegalArgumentException("invalid image ref: " + imageRef); Prevention
- Keep repository names lowercase, no spaces or underscores-only segments.
- Use fully-qualified references with registry host and explicit tag.
- Echo property-derived image names in CI before the build to catch empty/truncated values.
- Avoid hand-built references with string concatenation that can leave stray separators.
When it happens
Trigger: Setting <to><image>, <from><image>, or an extra tag to a malformed reference such as 'My Image', 'registry.example.com:port/img' (non-numeric port), 'Image:v1 final', or an empty string; also via -Dimage=... overrides.
Common situations: Typos in the image name, spaces or uppercase in repository names, unescaped tags with invalid characters, environment-variable-substituted values that resolve to empty or partial strings in CI.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- <message from InvalidImageReferenceException via HelpfulSugg
- HelpfulSuggestions.forInvalidImageReference(${ex.getInvalidR
- <container><appRoot> is not an absolute Unix-style path: ${e
- invalid value for <containerizingMode>: ${ex.getInvalidConta
- <container><appRoot> is not an absolute Unix-style path: <in
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/7755431ac2adf6ca.
Report an issue: GitHub.