GoogleContainerTools/jib · error · GradleException

extraDirectories.paths contain "from" directory that doesn't

Error message

extraDirectories.paths contain "from" directory that doesn't exist locally: ${ex.getPath()}

What it means

BuildTarTask.buildTar catches ExtraDirectoryNotFoundException and throws a GradleException stating that an extraDirectories.paths entry with a 'from' directory does not exist locally. Jib validates extra-layer source directories before building and aborts when a configured source path is missing.

Source

Thrown at jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildTarTask.java:203

    } catch (JibPluginExtensionException ex) {
      String extensionName = ex.getExtensionClass().getName();
      throw new GradleException(
          "error running extension '" + extensionName + "': " + ex.getMessage(), ex);

    } catch (IncompatibleBaseImageJavaVersionException ex) {
      throw new GradleException(
          HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForGradle(
              ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),
          ex);

    } catch (InvalidImageReferenceException ex) {
      throw new GradleException(
          HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);

    } catch (ExtraDirectoryNotFoundException ex) {
      throw new GradleException(
          "extraDirectories.paths contain \"from\" directory that doesn't exist locally: "
              + ex.getPath(),
          ex);
    } finally {
      tempDirectoryProvider.close();
      TaskCommon.finishUpdateChecker(projectProperties, updateCheckFuture);
      projectProperties.waitForLoggingThread();
    }
  }

  @Override
  public BuildTarTask setJibExtension(JibExtension jibExtension) {
    this.jibExtension = jibExtension;
    return this;
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Create the missing 'from' directory or correct the path in extraDirectories.paths
  2. Ensure any task that generates the directory runs before the jib task (e.g. make jibBuildTar dependOn it)
  3. In multi-module builds, verify the path is relative to the correct project's directory or use an absolute path via project.file(...)

Example fix

// before
jib { extraDirectories { paths { path { from = file('src/main/jib-extra') } } } } // directory absent
// after: create src/main/jib-extra, or point to an existing dir
jib { extraDirectories { paths { path { from = file('src/main/jib') } } } }
Defensive patterns

Strategy: validation

Validate before calling

def extraDir = file('src/main/jib-extra')
if (!extraDir.isDirectory()) throw new GradleException("extra dir missing: $extraDir")

Prevention

When it happens

Trigger: Configuring jib { extraDirectories { paths { path { from = file('src/main/jib-custom') } } } } where that 'from' directory does not exist on disk when the jibBuildTar task runs.

Common situations: Directory renamed or deleted; path only generated by another task that did not run (task ordering); CI checkout excludes the directory; relative path resolved against the wrong project/module directory in multi-project builds.

Related errors


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