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

jib-maven-plugin throws this when an extra directories 'from' path configured via <extraDirectories><paths> does not exist on the local filesystem. ExtraDirectoryNotFoundException carries the missing path, which is appended to the message in BuildImageMojo.execute.

Source

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

          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).
  2. Fix the <from> path in the jib configuration to point at an existing directory.
  3. Remove the <extraDirectories> block if extra files are not needed.

Example fix

<!-- before -->
<extraDirectories><paths><path><from>src/main/jbi</from></path></paths></extraDirectories>
<!-- after -->
<extraDirectories><paths><path><from>src/main/jib</from></path></paths></extraDirectories>
Defensive patterns

Strategy: validation

Validate before calling

String extraDir = "src/main/jib";
if (!new java.io.File(extraDir).isDirectory()) {
  throw new IllegalStateException("extra directories 'from' path missing: " + extraDir);
}

Try / catch

try { ... } catch (MojoExecutionException e) { if (e.getMessage().contains("from\" directory that doesn't exist")) { /* create dir or fix path */ } throw e; }

Prevention

When it happens

Trigger: Running 'mvn jib:build' with <extraDirectories><paths><path><from>src/main/jib-custom</from>...</path></paths></extraDirectories> where that directory is absent in the project.

Common situations: Renaming or deleting the src/main/jib directory while keeping the pom config; path typo; CI checkout that excludes the directory (sparse checkout, wrong working directory).

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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