{"record":{"id":"5fcb8e90540469ca","repo":"GoogleContainerTools/jib","slug":"exception-message-ioexception-cachedirectorycr","errorCode":null,"errorMessage":"<exception message (IOException | CacheDirectoryCreationException | MainClassInferenceException | InvalidGlobalConfigException)>","messagePattern":"<exception message \\(IOException \\| CacheDirectoryCreationException \\| MainClassInferenceException \\| InvalidGlobalConfigException\\)>","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildImageMojo.java","lineNumber":178,"sourceCode":"      String extensionName = ex.getExtensionClass().getName();\n      throw new MojoExecutionException(\n          \"error running extension '\" + extensionName + \"': \" + ex.getMessage(), ex);\n\n    } catch (IncompatibleBaseImageJavaVersionException ex) {\n      throw new MojoExecutionException(\n          HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven(\n              ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),\n          ex);\n\n    } catch (InvalidImageReferenceException ex) {\n      throw new MojoExecutionException(\n          HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);\n\n    } catch (IOException\n        | CacheDirectoryCreationException\n        | MainClassInferenceException\n        | InvalidGlobalConfigException ex) {\n      throw new MojoExecutionException(ex.getMessage(), ex);\n\n    } catch (BuildStepsExecutionException ex) {\n      throw new MojoExecutionException(ex.getMessage(), ex.getCause());\n\n    } catch (ExtraDirectoryNotFoundException ex) {\n      throw new MojoExecutionException(\n          \"<extraDirectories><paths> contain \\\"from\\\" directory that doesn't exist locally: \"\n              + ex.getPath(),\n          ex);\n    } finally {\n      tempDirectoryProvider.close();\n      MojoCommon.finishUpdateChecker(projectProperties, updateCheckFuture);\n      projectProperties.waitForLoggingThread();\n      getLog().info(\"\");\n    }\n  }\n}\n","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildImageMojo.java#L160-L196","documentation":"BuildImageMojo.execute groups IOException, CacheDirectoryCreationException, MainClassInferenceException, and InvalidGlobalConfigException and rethrows the underlying message as a MojoExecutionException. These are general build failures: filesystem/IO problems, inability to create the local jib cache, failure to infer a main class, or a corrupt/invalid global jib config (~/.jib/config.json).","triggerScenarios":"Running 'mvn jib:build' where an underlying operation throws IOException, cache directory cannot be created, no main class can be inferred (and none configured), or the global config file is invalid.","commonSituations":"Read-only or full disk blocking cache creation at ~/.cache/google-cloud-tools-jib; a multi-module or non-executable project with no discoverable main class (no Main-Class and multiple/duplicate main methods); a corrupted ~/.jib/config.json from a manual edit.","solutions":["Read the wrapped cause message in the output; it names which of the four failures occurred.","For cache issues, check disk space/permissions or set jib base cache directory to a writable path.","For main class inference, set <mainClass> in the jib configuration or in maven-shade/jar plugin config.","For InvalidGlobalConfigException, delete or fix ~/.jib/config.json."],"exampleFix":"<!-- before: no mainClass, inference fails -->\n<plugin>jib-maven-plugin...</plugin>\n<!-- after -->\n<configuration>\n  <mainClass>com.example.Main</mainClass>\n</configuration>","handlingStrategy":"try-catch","validationCode":"java.io.File cache = new java.io.File(System.getProperty(\"user.home\"), \".cache/google-cloud-tools-jib\");\nif (!cache.getParentFile().canWrite()) System.err.println(\"jib cache location not writable\");\njava.io.File globalCfg = new java.io.File(System.getProperty(\"user.home\"), \".jib/config.json\");\nif (globalCfg.exists()) new com.fasterxml.jackson.databind.ObjectMapper().readTree(globalCfg);","typeGuard":null,"tryCatchPattern":"try { ... } catch (MojoExecutionException e) {\n  Throwable c = e.getCause();\n  if (c instanceof MainClassInferenceException) { /* set <mainClass> */ }\n  else if (c instanceof InvalidGlobalConfigException) { /* fix ~/.jib/config.json */ }\n  throw e;\n}","preventionTips":["Ensure the cache directory's parent is writable and has free disk space","Always configure <mainClass> explicitly for non-trivial projects","Do not hand-edit ~/.jib/config.json; regenerate it if corrupted"],"tags":["maven","jib","io","cache","main-class"],"backgroundTag":"invalid-config-value","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"}