{"record":{"id":"35cf3a51204eafac","repo":"apache/iceberg","slug":"illegal-file-type-s-35cf3a","errorCode":null,"errorMessage":"Illegal file type: %s","messagePattern":"Illegal file type: (.+?)","errorType":"validation","errorClass":"org.apache.iceberg.exceptions.ValidationException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/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.2/spark/src/main/java/org/apache/iceberg/spark/actions/BaseSparkAction.java#L313-L349","documentation":"The file-count accumulator in BaseSparkAction's compute/delete logic only recognizes DATA, DELETES, and OTHERS content type strings; anything else fails ValidationException. It is an internal invariant that manifest/file classification stays in sync with the known content kinds.","triggerScenarios":"Running Spark actions (e.g. expireSnapshots, deleteOrphanFiles, rewriteDataFiles) when a processed file reports a content string outside the three recognized buckets — typically new metadata file kinds added in newer specs.","commonSituations":"Newer Iceberg writers producing metadata/content file types read by an older Spark action runtime; plugin or custom FileIO reporting nonstandard type strings.","solutions":["Upgrade the Iceberg Spark runtime so the action recognizes the new file type","Check for version skew between the catalog/writer and the Spark action jars","If due to custom code, ensure FileInfo/content strings are one of DATA, DELETES, OTHERS"],"exampleFix":"// before\n} else if (OTHERS.equalsIgnoreCase(type)) { otherFilesCount.addAndGet(numFiles);\n} else { throw new ValidationException(\"Illegal file type: %s\", type); }\n// after\n// upgrade runtime, or extend the else-if chain to cover the new type before throwing","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { SparkActions.get(spark).rewriteDataFiles(table).execute(); }\ncatch (ValidationException e) {\n  if (e.getMessage().startsWith(\"Illegal file type\")) { /* upgrade Iceberg runtime */ }\n  else throw e;\n}","preventionTips":["Run actions with a runtime at least as new as the writer","Keep catalog, writer, and action jars on the same Iceberg version","Watch spec releases for new file kinds"],"tags":["spark","actions","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"}