apache/druid · error · SegmentLoadingException

No files found in [%s]

Error message

No files found in [%s]

What it means

LocalDataSegmentPuller.getSegmentFiles lists the contents of the source directory holding the segment. File.listFiles() returns null (not an empty array) when the directory can't be read or the listing fails, so a null result is reported as "No files found" with the absolute path to help diagnose access problems.

Source

Thrown at server/src/main/java/org/apache/druid/segment/loading/LocalDataSegmentPuller.java:125

      }

      @Override
      public boolean delete()
      {
        return file.delete();
      }
    };
  }

  private static final Logger log = new Logger(LocalDataSegmentPuller.class);

  public FileUtils.FileCopyResult getSegmentFiles(final File sourceFile, final File dir) throws SegmentLoadingException
  {
    if (sourceFile.isDirectory()) {
      try {
        final File[] files = sourceFile.listFiles();
        if (files == null) {
          throw new SegmentLoadingException("No files found in [%s]", sourceFile.getAbsolutePath());
        }

        if (sourceFile.equals(dir)) {
          log.info("Asked to load [%s] into itself, done!", dir);
          return new FileUtils.FileCopyResult(Arrays.asList(files));
        }

        final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult();
        boolean link = true;
        for (final File oldFile : files) {
          if (oldFile.isDirectory()) {
            log.info("[%s] is a child directory, skipping", oldFile.getAbsolutePath());
            continue;
          }

          final File newFile = new File(dir, oldFile.getName());
          final FileUtils.LinkOrCopyResult linkOrCopyResult = FileUtils.linkOrCopy(oldFile, newFile);
          link = link && linkOrCopyResult == FileUtils.LinkOrCopyResult.LINK;

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Verify the directory exists and is readable/executable by the Druid user (chmod/chown as needed).
  2. Check whether the segment directory was concurrently deleted or moved and re-trigger segment load.
  3. If running in a container, confirm the segment volume is mounted and populated on this host.

Example fix

// before
$ ls -ld /var/druid/segments/wikipedia/2015/.../index.zip-dir  # druid cannot read
// after
$ chmod -R o+rx /var/druid/segments && restart historical / retry load
Defensive patterns

Strategy: validation

Validate before calling

File src = new File(path);
if (!src.isDirectory() || !src.canRead() || src.listFiles() == null) {
  throw new IOException("Segment directory unreadable: " + src.getAbsolutePath());
}

Prevention

When it happens

Trigger: getSegmentFiles(sourceFile, dir) invoked when sourceFile.listFiles() returns null — permissions deny read access, sourceFile vanished between isDirectory() and listFiles(), or an I/O error on the listing.

Common situations: Historical nodes pulling segments from a local deep storage directory whose permissions changed; segments deleted concurrently by cleanup jobs; container mounts missing the expected directory contents.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/43a5e2d13957d5d6. Report an issue: GitHub.