apache/iceberg · error · IllegalArgumentException

Unsupported file type

Error message

Unsupported file type: ${file.getClass().getSimpleName()}

What it means

SnapshotSummary's deletedFile(PartitionSpec, ContentFile) dispatches on the concrete file type and only accepts DataFile and DeleteFile. Any other ContentFile implementation (a custom or newer-spec ContentFile subtype) throws IllegalArgumentException. It indicates the producer was handed a file type this Iceberg version does not know how to summarize.

Solutions

  1. Pass the concrete Iceberg types: use the file's DataFile or DeleteFile reference (e.g., from table.io / GenericDataFile) rather than a custom ContentFile.
  2. Align Iceberg versions — upgrade the runtime to the version that matches the table's format version and the file classes in use.
  3. Check the reported class name in the message; if it's your own class, make it extend GenericDataFile/GenericDeleteFile or convert it with DataFiles/transform builders.

Example fix

// before
ContentFile<?> wrapped = myEngineFile.toContentFile(); // custom impl
table.newRowDelta().addDeletes((DeleteFile) wrapped); // or deleteFile(wrapped) -> IllegalArgumentException
// after
DeleteFile deleteFile = GenericDeleteFile.of(...); // or the original DataFile/DeleteFile instance
table.newRowDelta().addDeletes(deleteFile).commit();
Defensive patterns

Strategy: type-guard

Validate before calling

// only pass concrete Iceberg file types to producers
boolean supported = file instanceof DataFile || file instanceof DeleteFile;

Type guard

static DeleteFile asDeleteFile(ContentFile<?> f) {
  Preconditions.checkArgument(f instanceof DeleteFile,
      "Expected DeleteFile, got %s", f.getClass().getSimpleName());
  return (DeleteFile) f;
}

Try / catch

try {
  producer.deletedFile(spec, contentFile);
} catch (IllegalArgumentException e) {
  throw new IllegalStateException("Unsupported ContentFile impl: " + contentFile.getClass() +
      "; convert to DataFile/DeleteFile", e);
}

Prevention

When it happens

Trigger: Calling newDelete/newOverwrite/newRowDelta .deleteFile(...) (or a producer path that records deletions) with a ContentFile that is neither DataFile nor DeleteFile — e.g., a custom ContentFile implementation, or a file type from a newer format/spec read by an older Iceberg runtime.

Common situations: Custom engines/wrappers building their own ContentFile impls instead of Iceberg's GenericDataFile/GenericDeleteFile; classpath with an older Iceberg version than the one that wrote the table (version skew); generic file-rewrite frameworks passing wrapped files of the wrong type.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/1d9fb8065c305ddf. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/SnapshotSummary.java:134

    }

    public void addedFile(PartitionSpec spec, DataFile file) {
      metrics.addedFile(file);
      updatePartitions(spec, file, true);
    }

    public void addedFile(PartitionSpec spec, DeleteFile file) {
      metrics.addedFile(file);
      updatePartitions(spec, file, true);
    }

    public void deletedFile(PartitionSpec spec, ContentFile<?> file) {
      if (file instanceof DataFile) {
        deletedFile(spec, (DataFile) file);
      } else if (file instanceof DeleteFile) {
        deletedFile(spec, (DeleteFile) file);
      } else {
        throw new IllegalArgumentException(
            "Unsupported file type: " + file.getClass().getSimpleName());
      }
    }

    public void deletedFile(PartitionSpec spec, DataFile file) {
      metrics.removedFile(file);
      updatePartitions(spec, file, false);
    }

    public void deletedFile(PartitionSpec spec, DeleteFile file) {
      metrics.removedFile(file);
      updatePartitions(spec, file, false);
    }

    public void addedManifest(ManifestFile manifest) {
      this.trustPartitionMetrics = false;
      partitionMetrics.clear();
      metrics.addedManifest(manifest);

View on GitHub (pinned to 86d9c8fc54)