GoogleContainerTools/jib · error · MojoExecutionException

<extraDirectories><paths> contain "from" directory that does

Error message

<extraDirectories><paths> contain "from" directory that doesn't exist locally: <path>

What it means

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.

Source

Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildDockerMojo.java:170

          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();
      MojoCommon.finishUpdateChecker(projectProperties, updateCheckFuture);
      projectProperties.waitForLoggingThread();
      getLog().info("");
    }
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Create the missing directory (e.g. mkdir -p src/main/jib-custom) or fix the configured path to point at an existing directory.
  2. Check the path is relative to the correct module root in multi-module builds.
  3. If the directory is generated, ensure the generating step runs before the Jib goal.
  4. 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).

Example fix

<!-- before -->
<extraDirectories><paths><path>src/main/jib-custom</path></paths></extraDirectories>
<!-- after (path exists or default) -->
<extraDirectories><paths><path>src/main/jib</path></paths></extraDirectories>
Defensive patterns

Strategy: validation

Validate before calling

java.nio.file.Path dir = java.nio.file.Paths.get(extraDirFrom);
if (!java.nio.file.Files.isDirectory(dir)) {
  throw new IllegalStateException("extraDirectories 'from' path missing: " + dir);
}

Type guard

boolean extraDirExists(String p) { return p != null && java.nio.file.Files.isDirectory(java.nio.file.Paths.get(p)); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/2cfc869a590e2df7. Report an issue: GitHub.