{"record":{"id":"6bf4b21ac73dc4a8","repo":"GoogleContainerTools/jib","slug":"ex-getmessage","errorCode":null,"errorMessage":"${ex.getMessage()}","messagePattern":"\\$\\{ex\\.getMessage\\(\\)\\}","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2.java","lineNumber":217,"sourceCode":"        resolutionResult.getDependencies().stream()\n            .map(org.eclipse.aether.graph.Dependency::getArtifact)\n            .filter(org.eclipse.aether.artifact.Artifact::isSnapshot)\n            .map(org.eclipse.aether.artifact.Artifact::getFile)\n            .map(File::toPath)\n            .forEach(skaffoldFilesOutput::addInput);\n\n      } catch (DependencyResolutionException ex) {\n        throw new MojoExecutionException(\"Failed to resolve dependencies\", ex);\n      }\n    }\n\n    try {\n      // Print JSON string\n      System.out.println();\n      System.out.println(\"BEGIN JIB JSON\");\n      System.out.println(skaffoldFilesOutput.getJsonString());\n    } catch (IOException ex) {\n      throw new MojoExecutionException(ex.getMessage(), ex);\n    }\n  }\n\n  private List<Path> resolveExtraDirectories(MavenProject project) {\n    return collectExtraDirectories(project).stream()\n        .map(path -> path.isAbsolute() ? path : project.getBasedir().toPath().resolve(path))\n        .collect(Collectors.toList());\n  }\n\n  private List<Path> collectExtraDirectories(MavenProject project) {\n    // Try getting extra directory from project/session properties\n    String property =\n        MavenProjectProperties.getProperty(PropertyNames.EXTRA_DIRECTORIES_PATHS, project, session);\n    if (property != null) {\n      List<String> paths = ConfigurationPropertyValidator.parseListProperty(property);\n      return paths.stream().map(Paths::get).collect(Collectors.toList());\n    }\n","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2.java#L199-L235","documentation":"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.","triggerScenarios":"Calling skaffold-files and SkaffoldFilesOutput.getJsonString() raises IOException while serializing the collected file paths and goal list to JSON.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { ... } catch (MojoExecutionException e) {\n  if (e.getCause() instanceof IOException) {\n    logger.error(\"Jib JSON serialization failed: \" + e.getMessage(), e); // upgrade plugin\n  }\n}","preventionTips":["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"],"tags":["maven","skaffold","json","io"],"backgroundTag":"json-serialization-failed","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"}