apache/iceberg · error · UnsupportedOperationException
Cannot modify ManifestEntryWrapper wrapper via set
Error message
Cannot modify ManifestEntryWrapper wrapper via set
What it means
ManifestEntryWrapper in V1Metadata is a read-only StructLike view over a ManifestEntry. Manifest entries are immutable metadata records; set(pos, value) deliberately throws UnsupportedOperationException to prevent in-place corruption of entry data (status, snapshot ids, data file).
Solutions
- Do not mutate the wrapper; build a new ManifestEntry (e.g. via entry builder) with the desired status/file
- Copy the wrapped fields into a fresh Record and modify the copy
- For rewriting entries, use ManifestWriter/ManifestWriter factories rather than mutating existing structs
Example fix
// before entryWrapper.set(0, Status.DELETED); // after ManifestEntry updated = new ManifestEntry(Status.DELETED, entry.snapshotId(), entry.dataSequenceNumber(), entry.fileSequenceNumber(), entry.file());
Defensive patterns
Strategy: validation
Validate before calling
if (entry instanceof V1Metadata.ManifestEntryWrapper) { throw new IllegalStateException("ManifestEntryWrapper is read-only; build a new ManifestEntry"); } Type guard
boolean isReadOnlyEntry(Object s) { return s instanceof V1Metadata.ManifestEntryWrapper || s instanceof V2Metadata.ManifestEntryWrapper; } Try / catch
try { entryWrapper.set(pos, value); } catch (UnsupportedOperationException e) { throw new IllegalStateException("use ManifestEntry builder instead of mutating entry", e); } Prevention
- Create new ManifestEntry objects for status/file changes
- Use ManifestWriter rather than mutating existing entries
- Assume all StructLike views in core metadata are immutable
When it happens
Trigger: Calling set(pos, value) on a ManifestEntryWrapper produced by V1Metadata.ManifestEntryWrapper.wrap(entry), e.g. from generic writers or code that mutates entry status/fields in place.
Common situations: Custom manifest writers or rewrite jobs that try to update entry status or data file in place; frameworks that treat all StructLike instances as mutable records.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Cannot modify DataFileWrapper wrapper via set
- Cannot modify ManifestEntryWrapper wrapper via set
- Cannot modify ManifestFileWrapper wrapper via set
- Cannot modify ManifestFileWrapper wrapper via set
- Backup table name cannot be specified
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/678f6a93419cb9c2.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/apache/iceberg/V1Metadata.java:260
ManifestEntryWrapper() {
this.size = entrySchema(Types.StructType.of()).columns().size();
this.fileWrapper = new DataFileWrapper();
}
public ManifestEntryWrapper wrap(ManifestEntry<DataFile> entry) {
this.wrapped = entry;
return this;
}
@Override
public int size() {
return size;
}
@Override
public <T> void set(int pos, T value) {
throw new UnsupportedOperationException("Cannot modify ManifestEntryWrapper wrapper via set");
}
@Override
public <T> T get(int pos, Class<T> javaClass) {
return javaClass.cast(get(pos));
}
private Object get(int pos) {
switch (pos) {
case 0:
return wrapped.status().id();
case 1:
return wrapped.snapshotId();
case 2:
DataFile file = wrapped.file();
if (file != null) {
return fileWrapper.wrap(file);
}View on GitHub (pinned to 86d9c8fc54)