apache/druid · error · SegmentLoadingException
Failed to write partial info file for segment[%s]
Error message
Failed to write partial info file for segment[%s]
What it means
When a segment is loaded for a partial-load rule, SegmentLocalCacheManager rewrites the on-disk info file so it carries the current rule's wrapped loadSpec before mounting. If that rewrite fails with an IOException, it is wrapped in this SegmentLoadingException.
Source
Thrown at server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java:1089
wrapper.getFingerprint()
);
}
// Rule couldn't be applied, nothing partial materialized, so hand back the plain segment; the
// announcement layer will fall back to segment.getSize() for loadedBytes.
return dataSegment;
}
final ReservedPartial reserved = findOrReservePartial(dataSegment, rangeReader);
try {
final PartialSegmentMetadataCacheEntry metadata = reserved.metadata();
// findOrReservePartial only invokes reservePartial (which writes the info file) on the fresh-reserve
// branch. On the find-existing branch the info file on disk still carries the PRIOR rule's wrapped
// load spec, so a rule swap here would apply in memory only. Rewrite unconditionally before mount.
try {
rewriteInfoFile(dataSegment);
}
catch (IOException e) {
throw new SegmentLoadingException(
e,
"Failed to write partial info file for segment[%s]",
dataSegment.getId()
);
}
try {
metadata.mount(reserved.location());
}
catch (IOException e) {
throw new SegmentLoadingException(
e,
"Failed to mount partial metadata for segment[%s]",
dataSegment.getId()
);
}
final PartialSegmentFileMapperV10 mapper = metadata.getFileMapper();
if (mapper == null) {
throw DruidException.defensive(View on GitHub (pinned to 9b90983fd2)
Solutions
- Check disk space and filesystem health on the segment cache location (druid.segmentCache.locations).
- Fix permissions/ownership on the cache info directory so the historical can write info files.
- Ensure the cache location directories exist and are writable at startup; remount if offline.
- After fixing the disk, let the coordinator re-queue the segment load.
Defensive patterns
Strategy: try-catch
Validate before calling
final File infoDir = new File(location.getPath(), "info_dir");
if (!infoDir.canWrite() || infoDir.getFreeSpace() < MIN_FREE_BYTES) {
throw new IllegalStateException("Cache location not writable or low on disk: " + infoDir);
} Try / catch
try {
cacheManager.loadPartial(segment, rule);
} catch (SegmentLoadingException e) {
if (e.getCause() instanceof IOException ioe && ioe.getMessage() != null && ioe.getMessage().contains("info file")) {
alertDiskProblem(e); // check disk space/permissions before retrying
} else {
throw e;
}
} Prevention
- Monitor free space on all druid.segmentCache.locations.
- Ensure cache directories are writable by the historical process user.
- Don't externally clean the info-hierarchy while the node runs.
- Set up disk-failure alerting; retry loads only after the disk issue is fixed.
When it happens
Trigger: loadPartial path calls rewriteInfoFile(dataSegment) and the underlying file write throws (disk full, permissions, location offline, missing directory).
Common situations: Cache disk full or read-only filesystem; cache directory permissions changed; info-hierarchy directory deleted underneath a running historical; disk hardware failure.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Failed to write to file: %s. Current size of file: %d
- Failed to write to file: %s. Current size of file: %d
- Exception while writing distribution file for interval [%s],
- Exception during serialization of lookups using file [%s]
- Failed to mount partial metadata for segment[%s]
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/12fc214eec39b2fc.
Report an issue: GitHub.