{"record":{"id":"eafb0348fa7cb6aa","repo":"apache/iceberg","slug":"illegal-file-type-s-eafb03","errorCode":null,"errorMessage":"Illegal file type: %s","messagePattern":"Illegal file type: (.+?)","errorType":"exception","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/actions/BaseSparkAction.java","lineNumber":331,"sourceCode":"        positionDeleteFilesCount.addAndGet(numFiles);\n\n      } else if (FileContent.EQUALITY_DELETES.name().equalsIgnoreCase(type)) {\n        equalityDeleteFilesCount.addAndGet(numFiles);\n\n      } else if (MANIFEST.equalsIgnoreCase(type)) {\n        manifestsCount.addAndGet(numFiles);\n\n      } else if (MANIFEST_LIST.equalsIgnoreCase(type)) {\n        manifestListsCount.addAndGet(numFiles);\n\n      } else if (STATISTICS_FILES.equalsIgnoreCase(type)) {\n        statisticsFilesCount.addAndGet(numFiles);\n\n      } else if (OTHERS.equalsIgnoreCase(type)) {\n        otherFilesCount.addAndGet(numFiles);\n\n      } else {\n        throw new ValidationException(\"Illegal file type: %s\", type);\n      }\n    }\n\n    public void deletedFile(String path, String type) {\n      if (FileContent.DATA.name().equalsIgnoreCase(type)) {\n        dataFilesCount.incrementAndGet();\n        LOG.trace(\"Deleted data file: {}\", path);\n\n      } else if (FileContent.POSITION_DELETES.name().equalsIgnoreCase(type)) {\n        positionDeleteFilesCount.incrementAndGet();\n        LOG.trace(\"Deleted positional delete file: {}\", path);\n\n      } else if (FileContent.EQUALITY_DELETES.name().equalsIgnoreCase(type)) {\n        equalityDeleteFilesCount.incrementAndGet();\n        LOG.trace(\"Deleted equality delete file: {}\", path);\n\n      } else if (MANIFEST.equalsIgnoreCase(type)) {\n        manifestsCount.incrementAndGet();","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/actions/BaseSparkAction.java#L313-L349","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Upgrade the Iceberg Spark runtime jar so it recognizes the file content type","Inspect the manifest to identify the unexpected content type","Check for mixed Iceberg versions between writers and the Spark action job"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"java.util.Set.of(\"DATA\",\"POSITION_DELETES\",\"EQUALITY_DELETES\").contains(file.content().name()) || metadataTypes.contains(type)","typeGuard":"boolean isKnownFileType(String type) { return KNOWN_TYPES.stream().anyMatch(t -> t.equalsIgnoreCase(type)); }","tryCatchPattern":"try { action.execute(); } catch (ValidationException e) { if (e.getMessage().startsWith(\"Illegal file type\")) { /* upgrade jar / inspect manifest */ } throw e; }","preventionTips":["Run actions and writers on the same Iceberg version","Spot-check manifests after spec upgrades","Pin a known-good Iceberg Spark runtime in the job"],"tags":["spark","file-content","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}