{"record":{"id":"2cfc869a590e2df7","repo":"GoogleContainerTools/jib","slug":"extradirectories-paths-contain-from-directory","errorCode":null,"errorMessage":"<extraDirectories><paths> contain \"from\" directory that doesn't exist locally: <path>","messagePattern":"<extraDirectories><paths> contain \"from\" directory that doesn't exist locally: <path>","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildDockerMojo.java","lineNumber":170,"sourceCode":"          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":152,"sourceCodeEnd":182,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildDockerMojo.java#L152-L182","documentation":"One of the 'from' directories declared under <extraDirectories><paths> does not exist on the local filesystem, so Jib cannot collect extra files to layer into the image. ExtraDirectoryNotFoundException is caught by BuildDockerMojo.execute() and converted into a MojoExecutionException that names the missing path.","triggerScenarios":"Running any jib goal with <extraDirectories><paths><path>src/main/jib-custom</path></paths></extraDirectories> (or -Djib.extraDirectories.paths=...) where that directory is absent from the project at build time.","commonSituations":"Custom extra-directory config pointing at a folder that was renamed or gitignored (so never checked out in CI); configuring 'from' values in a multi-module build with relative paths resolved against the wrong module; generated directories not yet created when the build starts.","solutions":["Create the missing directory (e.g. mkdir -p src/main/jib-custom) or fix the configured path to point at an existing directory.","Check the path is relative to the correct module root in multi-module builds.","If the directory is generated, ensure the generating step runs before the Jib goal.","Remove the <extraDirectories><paths> entry if the extra layer is no longer needed (Jib's default src/main/jib is optional and skipped when absent)."],"exampleFix":"<!-- before -->\n<extraDirectories><paths><path>src/main/jib-custom</path></paths></extraDirectories>\n<!-- after (path exists or default) -->\n<extraDirectories><paths><path>src/main/jib</path></paths></extraDirectories>","handlingStrategy":"validation","validationCode":"java.nio.file.Path dir = java.nio.file.Paths.get(extraDirFrom);\nif (!java.nio.file.Files.isDirectory(dir)) {\n  throw new IllegalStateException(\"extraDirectories 'from' path missing: \" + dir);\n}","typeGuard":"boolean extraDirExists(String p) { return p != null && java.nio.file.Files.isDirectory(java.nio.file.Paths.get(p)); }","tryCatchPattern":null,"preventionTips":["Verify each <extraDirectories><paths><path> exists (or is created) before running Jib goals.","Remember the default src/main/jib is optional — remove the config if you don't need an extra layer.","In multi-module builds, resolve relative paths against the correct module directory.","Ensure the directory isn't excluded by .gitignore so CI checkouts contain it."],"tags":["maven","jib","extra-directories","file-not-found"],"backgroundTag":"directory-not-found","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"}