apache/iceberg · error · ValidationException

Illegal file type: %s

Error message

Illegal file type: %s

What it means

ValidationException raised by the file-counting listener in BaseSparkAction when deleteOperation/deletedFiles receives a file type string that is not DATA, DATA_FILE, POSITION_DELETES, EQUALITY_DELETES, or OTHERS. It guards the counting logic that classifies manifest-deleted files during rewrite/cleanup actions.

Source

Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/actions/BaseSparkAction.java:331

        positionDeleteFilesCount.addAndGet(numFiles);

      } else if (FileContent.EQUALITY_DELETES.name().equalsIgnoreCase(type)) {
        equalityDeleteFilesCount.addAndGet(numFiles);

      } else if (MANIFEST.equalsIgnoreCase(type)) {
        manifestsCount.addAndGet(numFiles);

      } else if (MANIFEST_LIST.equalsIgnoreCase(type)) {
        manifestListsCount.addAndGet(numFiles);

      } else if (STATISTICS_FILES.equalsIgnoreCase(type)) {
        statisticsFilesCount.addAndGet(numFiles);

      } else if (OTHERS.equalsIgnoreCase(type)) {
        otherFilesCount.addAndGet(numFiles);

      } else {
        throw new ValidationException("Illegal file type: %s", type);
      }
    }

    public void deletedFile(String path, String type) {
      if (FileContent.DATA.name().equalsIgnoreCase(type)) {
        dataFilesCount.incrementAndGet();
        LOG.trace("Deleted data file: {}", path);

      } else if (FileContent.POSITION_DELETES.name().equalsIgnoreCase(type)) {
        positionDeleteFilesCount.incrementAndGet();
        LOG.trace("Deleted positional delete file: {}", path);

      } else if (FileContent.EQUALITY_DELETES.name().equalsIgnoreCase(type)) {
        equalityDeleteFilesCount.incrementAndGet();
        LOG.trace("Deleted equality delete file: {}", path);

      } else if (MANIFEST.equalsIgnoreCase(type)) {
        manifestsCount.incrementAndGet();

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade the Iceberg Spark runtime so the new file content type is recognized
  2. Ensure writer and reader Iceberg versions are compatible
  3. If reproducible with valid metadata, file an issue — a new Iceberg content type must be added to the classifier
Defensive patterns

Strategy: validation

Validate before calling

Set<String> known = Set.of("DATA", "POSITION_DELETES", "EQUALITY_DELETES", "OTHERS");
// verify all file contents in table metadata are known before running actions

Try / catch

try { SparkActions.get(spark).removeOrphanFiles(table).execute(); } catch (ValidationException e) { /* unknown file content type; upgrade connector */ }

Prevention

When it happens

Trigger: Executing SparkActions like removeOrphanFiles/rewriteDataFiles/deleteReachableFiles against a table whose metadata contains content types this connector version does not recognize (e.g. newer file content kinds).

Common situations: Older Spark connector processing metadata produced by a newer Iceberg writer that introduced a new content type; corrupted or hand-edited table metadata.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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