prestodb/presto · error · PrestoException
DRUID_SEGMENT_LOAD_ERROR
DRUID_SEGMENT_LOAD_ERROR
Error message
Zip doesn't contain file: %s
What it means
Thrown when readFile(name) is asked for a file that does not exist inside the segment zip archive. ZipIndexFileSource reads Druid segments stored as zips and looks up entries in the central directory (zipData); a missing entry means the requested file isn't in the archive.
Source
Thrown at presto-druid/src/main/java/com/facebook/presto/druid/segment/ZipIndexFileSource.java:67
private ZipFileData zipData;
public ZipIndexFileSource(DataInputSource dataInputSource)
{
this.dataInputSource = requireNonNull(dataInputSource, "dataInputSource is null");
zipData = readCentralDirectory();
}
/**
* Reads file inside a zip archive
*/
@Override
public byte[] readFile(String fileName)
throws IOException
{
ZipFileEntry entry = zipData.getEntry(fileName);
if (entry == null) {
throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, format("Zip doesn't contain file: %s", fileName));
}
byte[] fileData = new byte[(int) entry.getSize()];
readFully(entry, 0, fileData, 0, fileData.length);
return fileData;
}
@Override
public final void readFile(String fileName, long position, byte[] buffer)
throws IOException
{
ZipFileEntry entry = zipData.getEntry(fileName);
if (entry == null) {
throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, format("Zip doesn't contain file: %s", fileName));
}
readFully(entry, position, buffer, 0, buffer.length);
}
private void readFully(ZipFileEntry entry, long position, byte[] buffer, int bufferOffset, int bufferLength)View on GitHub (pinned to 55bb57d202)
Solutions
- Verify the requested file/column exists (list zip entries: unzip -l segment.zip)
- Refresh the segment cache or re-download the segment zip
- Align connector version with the Druid segment format version
- Fix the column/table mapping to match files actually in the zip
Example fix
// before
byte[] meta = indexFileSource.readFile("__metadata");
// after
if (zipHasEntry(indexFileSource, "__metadata")) {
byte[] meta = indexFileSource.readFile("__metadata");
} Defensive patterns
Strategy: validation
Validate before calling
// caller-side pre-check
ZipFile zip = new ZipFile(segmentZipPath);
boolean present = zip.stream().anyMatch(e -> e.getName().equals("__metadata"));
if (!present) { throw new PrestoException(NOT_FOUND, "Entry missing from segment zip"); } Type guard
function hasEntry(entries, name) { return entries != null && entries.some(e => e.name === name); } Try / catch
try {
byte[] data = indexFileSource.readFile(fileName);
} catch (PrestoException e) {
if (e.getErrorCode().getName().equals("DRUID_SEGMENT_LOAD_ERROR") && e.getMessage().contains("doesn't contain file")) {
// treat as missing column / stale segment: re-fetch
} else { throw e; }
} Prevention
- List zip entries (unzip -l) once per segment and build a whitelist of valid file names
- Invalidate caches when segments are replaced
- Match connector expectations to the Druid segment format version
- Check that the table mapping only references columns present in the segment
When it happens
Trigger: readFile(fileName) finds no ZipFileEntry for fileName — requesting meta.json/__metadata/a column file that the zip lacks.
Common situations: Querying a column absent from the segment zip, stale segment cache pointing to an older zip layout, wrong segment file supplied, Druid version differences in internal file names.
Related errors
- DRUID_SEGMENT_LOAD_ERROR
- DRUID_SEGMENT_LOAD_ERROR
- DRUID_SEGMENT_LOAD_ERROR
- DRUID_SEGMENT_LOAD_ERROR
- DRUID_SEGMENT_LOAD_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/2fdadc046591fdb2.
Report an issue: GitHub.