GoogleContainerTools/jib · error · MojoExecutionException
${ex.getMessage()}
Error message
${ex.getMessage()} What it means
After collecting Skaffold file inputs, FilesMojoV2 serializes the output to JSON and prints it to stdout between 'BEGIN JIB JSON' markers. If getJsonString() throws an IOException (serialization failure), the message is rethrown as a MojoExecutionException. This is unexpected because the JSON is generated in memory; it indicates a bug or I/O problem in the JSON writer.
Source
Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2.java:217
resolutionResult.getDependencies().stream()
.map(org.eclipse.aether.graph.Dependency::getArtifact)
.filter(org.eclipse.aether.artifact.Artifact::isSnapshot)
.map(org.eclipse.aether.artifact.Artifact::getFile)
.map(File::toPath)
.forEach(skaffoldFilesOutput::addInput);
} catch (DependencyResolutionException ex) {
throw new MojoExecutionException("Failed to resolve dependencies", ex);
}
}
try {
// Print JSON string
System.out.println();
System.out.println("BEGIN JIB JSON");
System.out.println(skaffoldFilesOutput.getJsonString());
} catch (IOException ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}
}
private List<Path> resolveExtraDirectories(MavenProject project) {
return collectExtraDirectories(project).stream()
.map(path -> path.isAbsolute() ? path : project.getBasedir().toPath().resolve(path))
.collect(Collectors.toList());
}
private List<Path> collectExtraDirectories(MavenProject project) {
// Try getting extra directory from project/session properties
String property =
MavenProjectProperties.getProperty(PropertyNames.EXTRA_DIRECTORIES_PATHS, project, session);
if (property != null) {
List<String> paths = ConfigurationPropertyValidator.parseListProperty(property);
return paths.stream().map(Paths::get).collect(Collectors.toList());
}
View on GitHub (pinned to fb949e2676)
Solutions
- Read the wrapped cause (mvn -e / -X) and upgrade jib-maven-plugin to the latest release, as most serialization bugs are fixed upstream.
- Check the reported input file paths for unusual characters or permission issues that break the writer.
- Report a bug to the Jib project with the full stack trace if reproducible on the latest version.
- As a workaround, reduce extraDirectories/symlinks that may produce problematic paths.
Defensive patterns
Strategy: try-catch
Try / catch
try { ... } catch (MojoExecutionException e) {
if (e.getCause() instanceof IOException) {
logger.error("Jib JSON serialization failed: " + e.getMessage(), e); // upgrade plugin
}
} Prevention
- Keep jib-maven-plugin up to date — serialization failures are plugin bugs
- Inspect the wrapped cause with mvn -e before assuming a project problem
- Avoid exotic characters/symlinks in paths fed to extraDirectories
When it happens
Trigger: Calling skaffold-files and SkaffoldFilesOutput.getJsonString() raises IOException while serializing the collected file paths and goal list to JSON.
Common situations: Rare in practice: a defect in the JSON serialization helper or an unusual character/path in collected inputs; usually seen with very old plugin versions.
Understand the failure class
Background: "JSON serialization failed", "not JSON serializable", "Failed to serialize": why JSON marshaling errors happen and how to fix them — this error's family across 46 libraries.
Related errors
- ${ex.getMessage()}
- <exception message (IOException | CacheDirectoryCreationExce
- <exception message (IOException | CacheDirectoryCreationExce
- Could not determine Jib plugin version
- Jib plugin version is %s but is required to be %s
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/6bf4b21ac73dc4a8.
Report an issue: GitHub.