apache/iceberg · error · UnsupportedOperationException

Unsupported file content type:

Error message

Unsupported file content type: 

What it means

PartitionStatsHandler.collectStatsForManifest accumulates per-file statistics by switching on FileContent (DATA, POSITION_DELETES, EQUALITY_DELETES); an unknown content enum value hits the default branch and throws UnsupportedOperationException. This guards against new FileContent kinds (or corrupted/forward-compat manifests) reaching stats computation unhandled.

Source

Thrown at core/src/main/java/org/apache/iceberg/PartitionStatsHandler.java:389

        if (file.format() == FileFormat.PUFFIN) {
          stats.set(PartitionStatistics.DV_COUNT_POSITION, stats.dvCount() + 1);
        } else {
          stats.set(
              PartitionStatistics.POSITION_DELETE_FILE_COUNT_POSITION,
              stats.positionDeleteFileCount() + 1);
        }

        break;
      case EQUALITY_DELETES:
        stats.set(
            PartitionStatistics.EQUALITY_DELETE_RECORD_COUNT_POSITION,
            stats.equalityDeleteRecordCount() + file.recordCount());
        stats.set(
            PartitionStatistics.EQUALITY_DELETE_FILE_COUNT_POSITION,
            stats.equalityDeleteFileCount() + 1);
        break;
      default:
        throw new UnsupportedOperationException("Unsupported file content type: " + file.content());
    }

    if (snapshot != null) {
      updateSnapshotInfo(stats, snapshot.snapshotId(), snapshot.timestampMillis());
    }

    // Note: Not computing the `TOTAL_RECORD_COUNT` for now as it needs scanning the data.
  }

  /**
   * Updates the modified time and snapshot ID in stats for the deleted manifest entry.
   *
   * @param stats partition statistics to be updated.
   * @param snapshot the snapshot corresponding to the deleted manifest entry.
   */
  private static void deletedEntry(PartitionStatistics stats, Snapshot snapshot) {
    if (snapshot != null) {
      updateSnapshotInfo(stats, snapshot.snapshotId(), snapshot.timestampMillis());

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade Iceberg to a version that handles the new file content type present in the manifests.
  2. Inspect the offending manifest entry's content field to identify the unexpected value.
  3. Exclude tables/manifests with unknown content types from partition-stats computation until the writer version is supported.

Example fix

// before (older Iceberg lacking the case)
PartitionStatsHandler.computeAndWrite(...); // throws on unknown content
// after (upgrade so the switch handles the new content)
case UNKNOWN_NEW_CONTENT:
  // handle or skip the entry
  break;
Defensive patterns

Strategy: try-catch

Validate before calling

boolean allKnown = manifest.entries().stream().allMatch(e ->
    e.file().content() == FileContent.DATA
    || e.file().content() == FileContent.POSITION_DELETES
    || e.file().content() == FileContent.EQUALITY_DELETES);

Try / catch

try {
  PartitionStatsHandler.computeAndWrite(...);
} catch (UnsupportedOperationException e) {
  if (!e.getMessage().contains("Unsupported file content type")) throw e;
  LOG.warn("Manifest contains unsupported file content; upgrade Iceberg", e);
}

Prevention

When it happens

Trigger: Computing partition statistics (PartitionStatsHandler.computeAndWrite/collectStats) over a manifest whose FileContent enum value is not one of the three known kinds — e.g. a future format version introducing new content types or a corrupt manifest entry.

Common situations: Using a current Iceberg version against metadata files written by a newer experimental version that defines additional file content types.

Related errors


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