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
Jib throws ExtraDirectoryNotFoundException when a directory configured under jib.extraDirectories.paths has a 'from' path that does not exist on the local filesystem, aborting the build before layer creation. The Gradle task wraps it in a GradleException naming the missing path.
Source
Thrown at jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildImageTask.java:182
} 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 BuildImageTask setJibExtension(JibExtension jibExtension) {
this.jibExtension = jibExtension;
return this;
}
}
View on GitHub (pinned to fb949e2676)
Solutions
- Create the missing directory or fix the path in jib.extraDirectories.paths so it points at an existing directory
- Commit/generate the extra directory in CI before running jib (e.g. a resources-generation step)
- Remove the extraDirectories block entirely if the extra files are no longer needed
- If only a 'to' destination inside the image is wanted, set 'to' but ensure 'from' still exists locally
Example fix
// before
jib { extraDirectories { paths { path { from = 'src/main/extra-jib' } } } } // dir deleted
// after
jib { extraDirectories { paths { path { from = 'src/main/jib' } } } } // dir exists in repo Defensive patterns
Strategy: validation
Validate before calling
def extraFrom = 'src/main/jib'
def f = file(extraFrom)
if (!f.exists()) throw new GradleException("Extra directory missing: $extraFrom")
if (!f.isDirectory()) throw new GradleException("Extra directory is not a directory: $extraFrom") Prevention
- Commit extra directories to source control or generate them in an earlier task wired with dependsOn
- Re-check extraDirectories paths after refactoring project layout
- Use relative paths anchored to the project directory in CI
When it happens
Trigger: Running gradle jib/jibBuild/DockerBuild with jib { extraDirectories { paths { path { from = 'some/dir' } } } } where 'some/dir' (or a default src/main/jib directory configured with an explicit from) does not exist locally.
Common situations: Renaming or deleting a resources directory without updating build.gradle; wrong working directory when running Gradle; CI checkout missing the extra directory (not committed or generated by an earlier step that was skipped); typos in the path.
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
- extraDirectories.paths contain "from" directory that doesn't
- Incomplete extraDirectories.paths configuration; source dire
- <extraDirectories><paths> contain "from" directory that does
- <extraDirectories><paths> contain "from" directory that does
- ${file}
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/ca3a90538d8ba918.
Report an issue: GitHub.