apache/iceberg · error · UncheckedIOException
Failed to rewrite the manifest list file
Error message
Failed to rewrite the manifest list file {} What it means
RewriteTablePathUtil.rewriteManifestList copies a snapshot's manifest list while rewriting paths for table relocation/staging (e.g., snapshot copy or table migration). An IOException during writing the rewritten manifest list is rethrown as UncheckedIOException including the manifest list location. It indicates the new manifest list file could not be produced.
Solutions
- Check write permissions and free space on the staging/target location
- Verify the target FileIO/prefix configuration (credentials, endpoint) is correct and retry
- Re-run the rewrite from a clean staging directory, removing partial output files
Example fix
// before
RewriteTablePathUtil.rewriteManifestList(snapshot, io, sourcePrefix, stagingDir, specsById);
// after
try {
RewriteTablePathUtil.rewriteManifestList(snapshot, io, sourcePrefix, stagingDir, specsById);
} catch (UncheckedIOException e) {
LOG.error("Manifest list rewrite failed for {}: {}", snapshot.manifestListLocation(), e.getMessage());
// verify staging dir writability, then retry
} Defensive patterns
Strategy: try-catch
Validate before calling
File stagingDirFile = new File(stagingDir);
Preconditions.checkArgument(stagingDirFile.canWrite() && stagingDirFile.getUsableSpace() > 0,
"Staging dir not writable or full: " + stagingDir); Try / catch
try {
RewriteTablePathUtil.rewriteManifestList(snapshot, io, sourcePrefix, stagingDir, specsById);
} catch (UncheckedIOException e) {
// check staging dir writability/space and target prefix permissions, clean partials, retry
} Prevention
- Pre-flight check staging directory writability and free space
- Verify target-prefix credentials before relocation
- Clean partial outputs before re-running
- Run relocations with sufficient disk headroom
When it happens
Trigger: Calling rewriteManifestList (via RewriteTablePathUtil rewrite/copy utilities, e.g. table staging or relocation) when writing the manifest list to the staging/target location fails with IOException.
Common situations: Unwritable staging directory; disk full; object-store permission errors on the target prefix; interrupted network writes during table relocation.
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 close current writer
- Failed to close entries while caching changes
- Failed to close manifest list
- Failed to close manifest reader
- Failed to create tableMaintenance
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/a9641189b92daf0c.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/apache/iceberg/RewriteTablePathUtil.java:345
snapshot.firstRowId())) {
for (ManifestFile file : manifestFiles) {
ManifestFile newFile = file.copy();
((StructLike) newFile).set(0, newPath(newFile.path(), sourcePrefix, targetPrefix));
((StructLike) newFile)
.set(1, rewrittenManifestLengths.getOrDefault(file.path(), file.length()));
writer.add(newFile);
if (rewrittenManifestLengths.containsKey(file.path())) {
result.toRewrite().add(file);
result
.copyPlan()
.add(Pair.of(stagingPath(file.path(), sourcePrefix, stagingDir), newFile.path()));
}
}
return result;
} catch (IOException e) {
throw new UncheckedIOException(
"Failed to rewrite the manifest list file " + snapshot.manifestListLocation(), e);
}
}
private static List<ManifestFile> manifestFilesInSnapshot(FileIO io, Snapshot snapshot) {
try {
return snapshot.allManifests(io);
} catch (RuntimeIOException e) {
LOG.warn("Failed to read manifest list {}", snapshot.manifestListLocation(), e);
return ImmutableList.of();
}
}
/**
* Rewrite a data manifest, replacing path references.
*
* @param manifestFile source manifest file to rewrite
* @param snapshotIds snapshot ids for filtering returned data manifest entriesView on GitHub (pinned to 86d9c8fc54)