{"record":{"id":"ecc4c832f5d77bb8","repo":"apache/druid","slug":"can-t-find-location-to-handle-segment-s","errorCode":null,"errorMessage":"Can't find location to handle segment[%s]","messagePattern":"Can't find location to handle segment\\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManager.java","lineNumber":357,"sourceCode":"                segment.getId(),\n                subTaskId,\n                destFile\n            );\n            return segment.withSize(unzippedSizeBytes).withBinaryVersion(SegmentUtils.getVersionFromDir(segmentDir));\n          }\n          catch (Exception e) {\n            location.release(new FileNameCacheEntry(partitionFilePath, tempZippedFile.length()));\n            org.apache.commons.io.FileUtils.deleteQuietly(destFile);\n            LOG.warn(\n                e,\n                \"Failed to write segment[%s] at [%s]. Trying again with the next location\",\n                segment.getId(),\n                destFile\n            );\n          }\n        }\n      }\n      throw new ISE(\"Can't find location to handle segment[%s]\", segment);\n    }\n  }\n\n  @Override\n  public Optional<ByteSource> findPartitionFile(String supervisorTaskId, String subTaskId, Interval interval, int bucketId)\n  {\n    IdUtils.validateId(\"supervisorTaskId\", supervisorTaskId);\n    IdUtils.validateId(\"subTaskId\", subTaskId);\n    for (StorageLocation location : shuffleDataLocations) {\n      final File partitionDir = new File(location.getPath(), getPartitionDirPath(supervisorTaskId, interval, bucketId));\n      if (partitionDir.exists()) {\n        supervisorTaskCheckTimes.put(supervisorTaskId, getExpiryTimeFromNow());\n        final File segmentFile = new File(partitionDir, subTaskId);\n        if (segmentFile.exists()) {\n          return Optional.of(Files.asByteSource(segmentFile));\n        } else {\n          return Optional.empty();\n        }","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManager.java#L339-L375","documentation":"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.","triggerScenarios":"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.","commonSituations":"druid.worker.intermediaryPartitionStorageDir / storage location misconfiguration; disks full or not mounted on the Middle Manager/Peon host; permissions preventing writes.","solutions":["Check that intermediary storage locations are configured and exist on the worker host","Free disk space on all candidate locations (error follows from no location having room/being valid)","Verify filesystem permissions for the druid user on the storage dirs","Restart the worker after fixing mounts/disks so locations are re-detected"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for (File loc : storageLocations) { if (!loc.isDirectory() || loc.getUsableSpace() < minFreeBytes) throw new IllegalStateException(\"unusable intermediary location: \" + loc); }","typeGuard":null,"tryCatchPattern":"try { dataManager.addSegment(...); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"Can't find location\")) { alertOpsDiskFull(); } else { throw e; } }","preventionTips":["Provision ample free space on all intermediary storage dirs","Mount and permission-check storage locations at worker startup","Alert on low disk before exhaustion"],"tags":["druid","indexing","shuffle","storage"],"backgroundTag":"resource-not-found","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}