GoogleContainerTools/jib · error · IllegalArgumentException

Incomplete <extraDirectories><paths> configuration; source d

Error message

Incomplete <extraDirectories><paths> configuration; source directory must be set

What it means

An entry in the <extraDirectories><paths> configuration has an empty 'from' (source) directory. MojoCommon.getExtraDirectories validates each ExtraDirectoryParameters and throws IllegalArgumentException when directory.getFrom() equals Paths.get("") because Jib cannot copy from an unspecified source path.

Source

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

              projectProperties.log(LogEvent.lifecycle(privacyMessage));
              projectProperties.log(LogEvent.lifecycle(""));
            });
  }

  /**
   * Gets the list of extra directory paths from a {@link JibPluginConfiguration}. Returns {@code
   * (project dir)/src/main/jib} by default if not configured.
   *
   * @param jibPluginConfiguration the build configuration
   * @return the list of resolved extra directories
   */
  static List<ExtraDirectoryParameters> getExtraDirectories(
      JibPluginConfiguration jibPluginConfiguration) {
    List<ExtraDirectoryParameters> extraDirectories = jibPluginConfiguration.getExtraDirectories();
    if (!extraDirectories.isEmpty()) {
      for (ExtraDirectoryParameters directory : extraDirectories) {
        if (directory.getFrom().equals(Paths.get(""))) {
          throw new IllegalArgumentException(
              "Incomplete <extraDirectories><paths> configuration; source directory must be set");
        }
      }
      return extraDirectories;
    }

    MavenProject project = Preconditions.checkNotNull(jibPluginConfiguration.getProject());
    return Collections.singletonList(
        new ExtraDirectoryParameters(
            project.getBasedir().toPath().resolve("src").resolve("main").resolve("jib").toFile(),
            "/"));
  }

  /**
   * Converts a list of {@link PermissionConfiguration} to an equivalent {@code
   * String->FilePermission} map.
   *
   * @param permissionList the list to convert

View on GitHub (pinned to fb949e2676)

Solutions

  1. Set the <from> source directory on every <path> entry: e.g. <path><from>src/main/jib</from><into>/app</into></path>.
  2. Use the shorthand form <paths><path>src/main/jib</path></paths> if you don't need a custom <into>.
  3. Ensure any Maven property feeding <from> (e.g. ${extra.dir}) is defined and non-empty in the active profile.
  4. Remove entirely empty <path> elements left over from refactoring.

Example fix

<!-- before -->
<extraDirectories>
  <paths>
    <path><into>/app/resources</into></path>
  </paths>
</extraDirectories>

<!-- after -->
<extraDirectories>
  <paths>
    <path>
      <from>src/main/jib</from>
      <into>/app/resources</into>
    </path>
  </paths>
</extraDirectories>
Defensive patterns

Strategy: validation

Validate before calling

// Pre-validate extraDirectories config in a profile check or parent script:
// every <path> must have a non-empty <from>
// e.g. grep -A2 '<path>' pom.xml | grep -q '<from>' || echo 'missing <from> in extraDirectories path'

Try / catch

try {
  // jib build
} catch (IllegalArgumentException e) {
  if (e.getMessage().contains("source directory must be set")) {
    // add <from> to each <extraDirectories><paths><path> entry
  }
  throw e;
}

Prevention

When it happens

Trigger: Declaring <extraDirectories><paths><path><into>/app</into></path></paths></extraDirectories> with a <into> but no <from>; or an empty <path> element; programmatic construction of ExtraDirectoryParameters with an empty from path.

Common situations: Users migrating from the old <extraDirectory> singular config writing the new plural form but forgetting <from>; copy-pasting path elements and deleting the from line; templated pom generation that leaves from blank when a property is unset.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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