apache/iceberg · error · ValidationException

Illegal file type: %s

Error message

Illegal file type: %s

What it means

BaseSparkAction's counters classify deleted manifest entries by file content type (DATA, POSITION_DELETES, EQUALITY_DELETES, plus metadata types); a type string outside the recognized set fails validation with 'Illegal file type'. This indicates an unexpected ContentFile content value in the deleted-files stream.

Source

Thrown at spark/v4.1/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 jar so it recognizes the file content type
  2. Inspect the manifest to identify the unexpected content type
  3. Check for mixed Iceberg versions between writers and the Spark action job
Defensive patterns

Strategy: try-catch

Validate before calling

java.util.Set.of("DATA","POSITION_DELETES","EQUALITY_DELETES").contains(file.content().name()) || metadataTypes.contains(type)

Type guard

boolean isKnownFileType(String type) { return KNOWN_TYPES.stream().anyMatch(t -> t.equalsIgnoreCase(type)); }

Try / catch

try { action.execute(); } catch (ValidationException e) { if (e.getMessage().startsWith("Illegal file type")) { /* upgrade jar / inspect manifest */ } throw e; }

Prevention

When it happens

Trigger: Rewrite/delete Spark actions (e.g. remove_orphan_files-style or expire/deleteFileGroup flows) encountering a manifest entry whose content type string matches none of the expected constants — typically a newer Iceberg file type processed by older action code.

Common situations: Version skew: table written by a newer Iceberg introducing a new content type, actions run with an older Spark extension jar; corrupted or hand-edited manifests.

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/eafb0348fa7cb6aa. Report an issue: GitHub.