apache/druid · error · SegmentLoadingException
Asked to load path[%s], but it doesn't exist.
Error message
Asked to load path[%s], but it doesn't exist.
What it means
LocalDataSegmentPuller.getFile throws SegmentLoadingException when the path in the segment's local loadSpec does not exist on the filesystem. Druid was asked to load a segment whose recorded deep-storage file is missing, so it cannot serve data from this copy.
Source
Thrown at server/src/main/java/org/apache/druid/segment/loading/LocalDataSegmentPuller.java:241
return new Predicate<>()
{
@Override
public boolean apply(Throwable input)
{
return !(input instanceof InterruptedException)
&& !(input instanceof CancellationException)
&& (input instanceof Exception);
}
};
}
private File getFile(DataSegment segment) throws SegmentLoadingException
{
final Map<String, Object> loadSpec = segment.getLoadSpec();
final File path = new File(MapUtils.getString(loadSpec, "path"));
if (!path.exists()) {
throw new SegmentLoadingException("Asked to load path[%s], but it doesn't exist.", path);
}
return path;
}
}
View on GitHub (pinned to 9b90983fd2)
Solutions
- Check the path in the message on the historical node; restore the file from backup or another replica.
- Verify druid.storage.baseDir/baseKeyPrefix config matches where segments were actually pushed.
- Kill the missing segment via the coordinator kill API (or disable it) so metadata stops referencing it.
- If segments were moved, re-push them or update the loadSpec paths in metadata store to the new location.
Example fix
// before: base dir changed in config but old segments still on old path # druid.storage.baseDir=/mnt/new/deepstorage (segments live under /mnt/deepstorage) // after: point config back or move data # druid.storage.baseDir=/mnt/deepstorage mv /mnt/deepstorage/druid/segments /mnt/new/deepstorage/druid/segments
Defensive patterns
Strategy: validation
Validate before calling
String path = (String) segment.getLoadSpec().get("path");
if (path == null || !new File(path).exists()) {
throw new IllegalStateException("segment data missing on disk: " + path);
} Type guard
boolean localSegmentExists(DataSegment segment) {
Object p = segment.getLoadSpec().get("path");
return p instanceof String && new File((String) p).exists();
} Try / catch
try {
File f = puller.getSegmentFiles(segment, outDir);
} catch (SegmentLoadingException e) {
log.warn(e, "local segment file missing for %s; triggering re-replication", segment.getId());
} Prevention
- Don't delete or prune files in Druid deep storage with ad-hoc cron jobs; use the coordinator kill API.
- Keep druid.storage.baseDir/baseKeyPrefix consistent across cluster config changes.
- Use a shared, persistent filesystem for local deep storage across historical restarts.
- Maintain >=2 replicas so missing copies can be re-replicated automatically.
When it happens
Trigger: getFile(DataSegment) resolves loadSpec 'path' via new File(...) and path.exists() returns false — file deleted, host migrated, or path recorded on a different machine.
Common situations: Deep-storage directory wiped or cleaned by a retention job; local storage shared-name mismatch after host move; restore/archive operations removed the file but metadata still references it; typo in druid.storage.baseDir between clusters.
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
- Unable to load from local directory [%s]
- Do not know how to handle source [%s]
- e.getMessage()
- Keytab does not exist: %s
- Keytab does not exist:
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/70c9a7a22c8e4285.
Report an issue: GitHub.