apache/druid · error · IllegalStateException

Can't find location to handle segment[%s]

Error message

Can't find location to handle segment[%s]

What it means

LocalIntermediaryDataManager.addSegment selects one of the configured intermediary storage locations (by free space) to place the zipped segment. If it iterates every candidate location without finding a usable destination, it throws ISE("Can't find location to handle segment...") because the segment cannot be stored anywhere.

Source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManager.java:357

                segment.getId(),
                subTaskId,
                destFile
            );
            return segment.withSize(unzippedSizeBytes).withBinaryVersion(SegmentUtils.getVersionFromDir(segmentDir));
          }
          catch (Exception e) {
            location.release(new FileNameCacheEntry(partitionFilePath, tempZippedFile.length()));
            org.apache.commons.io.FileUtils.deleteQuietly(destFile);
            LOG.warn(
                e,
                "Failed to write segment[%s] at [%s]. Trying again with the next location",
                segment.getId(),
                destFile
            );
          }
        }
      }
      throw new ISE("Can't find location to handle segment[%s]", segment);
    }
  }

  @Override
  public Optional<ByteSource> findPartitionFile(String supervisorTaskId, String subTaskId, Interval interval, int bucketId)
  {
    IdUtils.validateId("supervisorTaskId", supervisorTaskId);
    IdUtils.validateId("subTaskId", subTaskId);
    for (StorageLocation location : shuffleDataLocations) {
      final File partitionDir = new File(location.getPath(), getPartitionDirPath(supervisorTaskId, interval, bucketId));
      if (partitionDir.exists()) {
        supervisorTaskCheckTimes.put(supervisorTaskId, getExpiryTimeFromNow());
        final File segmentFile = new File(partitionDir, subTaskId);
        if (segmentFile.exists()) {
          return Optional.of(Files.asByteSource(segmentFile));
        } else {
          return Optional.empty();
        }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Check that intermediary storage locations are configured and exist on the worker host
  2. Free disk space on all candidate locations (error follows from no location having room/being valid)
  3. Verify filesystem permissions for the druid user on the storage dirs
  4. Restart the worker after fixing mounts/disks so locations are re-detected
Defensive patterns

Strategy: validation

Validate before calling

for (File loc : storageLocations) { if (!loc.isDirectory() || loc.getUsableSpace() < minFreeBytes) throw new IllegalStateException("unusable intermediary location: " + loc); }

Try / catch

try { dataManager.addSegment(...); } catch (IllegalStateException e) { if (e.getMessage().startsWith("Can't find location")) { alertOpsDiskFull(); } else { throw e; } }

Prevention

When it happens

Trigger: addSegment() when all configured intermediary storage locations are unavailable — e.g. none exist, all fail the space/suitability checks, or the location list resolves to zero candidates for this supervisor/task.

Common situations: druid.worker.intermediaryPartitionStorageDir / storage location misconfiguration; disks full or not mounted on the Middle Manager/Peon host; permissions preventing writes.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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