{"record":{"id":"d0c7aa14d61bb13a","repo":"apache/iceberg","slug":"illegal-file-type-s-d0c7aa","errorCode":null,"errorMessage":"Illegal file type: %s","messagePattern":"Illegal file type: (.+?)","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/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.0/spark/src/main/java/org/apache/iceberg/spark/actions/BaseSparkAction.java#L313-L349","documentation":"BaseSparkAction's file-counting collector validates the content type string of each deleted/added file group. If the type is neither DATA, POSITION_DELETES, EQUALITY_DELETES, nor a recognized metadata/manifest/statistics type, it throws ValidationException 'Illegal file type: %s', signaling unrecognized content in a file group.","triggerScenarios":"Running Spark actions (e.g. expireSnapshots, removeOrphanFiles, deleteFileGroup path) against table metadata containing a ContentFile/manifest content type string this Iceberg version does not know — usually tables written by a newer Iceberg version.","commonSituations":"Version skew: a newer Iceberg writes a new file content kind, then an older iceberg-spark processes the table; corrupted or hand-edited metadata.","solutions":["Upgrade iceberg-spark to at least the version that wrote the table","Inspect the file type string in the message and map it to the newest Iceberg spec","Do not hand-edit table metadata; restore from a valid metadata snapshot if corrupted"],"exampleFix":"// before\n} else {\n  throw new ValidationException(\"Illegal file type: %s\", type);\n}\n// after\n} else if (POSITION_DELETES.equalsIgnoreCase(type)) {\n  positionDeletesCount.addAndGet(numFiles);\n} else {\n  throw new ValidationException(\"Illegal file type: %s\", type);\n}","handlingStrategy":"validation","validationCode":"Set<String> known = Set.of(\"DATA\",\"POSITION_DELETES\",\"EQUALITY_DELETES\",\"MANIFEST\",\"MANIFEST_LIST\",\"INDEX\",\"STATISTICS\",\"OTHERS\");\n// before running actions, check no unknown content kinds appear in table files","typeGuard":null,"tryCatchPattern":"try { action.execute(); } catch (ValidationException e) { if (e.getMessage().startsWith(\"Illegal file type\")) { LOG.error(\"Table written by newer Iceberg? Upgrade the runtime.\", e); throw e; } throw e; }","preventionTips":["Keep iceberg-spark at or above the version that wrote the table","Never hand-edit metadata files","Coordinate Iceberg version rollouts across jobs"],"tags":["spark","validation","file-content","version-skew"],"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"}