GoogleContainerTools/jib · error · GradleException

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

Error message

extraDirectories.paths contain "from" directory that doesn't exist locally: ${path}

What it means

The Jib Gradle plugin throws this when an extraDirectories entry points to a local directory path configured as the 'from' location, but that directory does not exist on disk at build time. Jib copies files from these directories into the image, so a missing source directory is treated as a configuration error rather than silently producing an empty layer. It is wrapped in a GradleException with the offending path in the message.

Source

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

          ex);

    } 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 BuildDockerTask setJibExtension(JibExtension jibExtension) {
    this.jibExtension = jibExtension;
    return this;
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Create the missing directory at the configured path (e.g. mkdir -p src/main/jib) or commit it to version control.
  2. Fix the path in build.gradle so jib.extraDirectories.points to an existing directory.
  3. Remove the extraDirectories entry if it is no longer needed.
  4. If the directory is generated, ensure the generation task runs before the Jib task (dependsOn).

Example fix

// before
jib {
  extraDirectories {
    paths { path 'src/main/jib-resources' }
  }
}
// after
jib {
  extraDirectories {
    paths { path 'src/main/jib' } // directory exists in the project
  }
}
Defensive patterns

Strategy: validation

Validate before calling

def extraDir = 'src/main/jib'
def f = file(extraDir)
if (!f.isDirectory()) throw new GradleException("extraDirectories 'from' path does not exist: $extraDir")

Try / catch

try {
  tasks.named('jib').get().execute()
} catch (GradleException e) {
  if (e.message?.startsWith('extraDirectories.paths contain')) {
    logger.error("Create or fix the directory named in: ${e.message}")
  }
  throw e
}

Prevention

When it happens

Trigger: Running any jib task (e.g. gradle jib, jibDockerBuild, buildTar) where jib.extraDirectories.paths contains a path whose 'from' directory does not exist locally, typically after renaming/moving a resources directory or a typo in the path.

Common situations: Developers add extraDirectories config referencing 'src/main/jib' variants that were deleted or renamed; CI checkouts missing directories because they are gitignored or generated by a prior step; switching branches where the directory doesn't exist; absolute paths valid on one machine but not another.

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/34ea154f91bb9b08. Report an issue: GitHub.