{"record":{"id":"4ac4f613f768332e","repo":"apache/iceberg","slug":"unsupported-changelog-scan-task-type","errorCode":null,"errorMessage":"Unsupported changelog scan task type: ","messagePattern":"Unsupported changelog scan task type: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/ChangelogRowReader.java","lineNumber":110,"sourceCode":"    metadataRow.update(0, UTF8String.fromString(task.operation().name()));\n    metadataRow.update(1, task.changeOrdinal());\n    metadataRow.update(2, task.commitSnapshotId());\n\n    return metadataRow;\n  }\n\n  private CloseableIterable<InternalRow> openChangelogScanTask(ChangelogScanTask task) {\n    if (task instanceof AddedRowsScanTask) {\n      return openAddedRowsScanTask((AddedRowsScanTask) task);\n\n    } else if (task instanceof DeletedRowsScanTask) {\n      throw new UnsupportedOperationException(\"Deleted rows scan task is not supported yet\");\n\n    } else if (task instanceof DeletedDataFileScanTask) {\n      return openDeletedDataFileScanTask((DeletedDataFileScanTask) task);\n\n    } else {\n      throw new IllegalArgumentException(\n          \"Unsupported changelog scan task type: \" + task.getClass().getName());\n    }\n  }\n\n  CloseableIterable<InternalRow> openAddedRowsScanTask(AddedRowsScanTask task) {\n    String filePath = task.file().location();\n    SparkDeleteFilter deletes = new SparkDeleteFilter(filePath, task.deletes(), counter(), true);\n    return deletes.filter(rows(task, deletes.requiredSchema()));\n  }\n\n  private CloseableIterable<InternalRow> openDeletedDataFileScanTask(DeletedDataFileScanTask task) {\n    String filePath = task.file().location();\n    SparkDeleteFilter deletes =\n        new SparkDeleteFilter(filePath, task.existingDeletes(), counter(), true);\n    return deletes.filter(rows(task, deletes.requiredSchema()));\n  }\n\n  private CloseableIterable<InternalRow> rows(ContentScanTask<DataFile> task, Schema readSchema) {","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/ChangelogRowReader.java#L92-L128","documentation":"ChangelogRowReader.openChangelogScanTask dispatches on the ChangelogScanTask subtype and throws IllegalArgumentException when the task type is none of AddedRowsScanTask, DeletedRowsScanTask, or DeletedDataFileScanTask. This guards against unknown/future task types produced by a mismatched scan planner.","triggerScenarios":"A ChangelogScanTask subclass not handled by the if/else chain reaches openChangelogScanTask, e.g. a new task type added in a newer Iceberg core while this Spark reader is older, or a custom scan task implementation.","commonSituations":"Version skew between iceberg-spark and iceberg-core jars on the classpath (mixed versions after upgrade); custom ChangelogScanTask implementations; internal bugs in scan planning.","solutions":["Align all Iceberg module versions (spark runtime + core) to the same release","Check which task class name is printed in the message and whether it comes from a custom/old jar","Remove duplicate/shaded Iceberg jars from the classpath","Upgrade iceberg-spark to a release that supports the task type"],"exampleFix":"// before: mixed iceberg-core 1.6 with iceberg-spark 1.4 on classpath\n// after: use one version\nimplementation 'org.apache.iceberg:iceberg-spark-runtime-4.1_2.13:1.6.1'","handlingStrategy":"type-guard","validationCode":"// before reading changelog tasks\nif (!(task instanceof AddedRowsScanTask) && !(task instanceof DeletedRowsScanTask) && !(task instanceof DeletedDataFileScanTask)) {\n  throw new IllegalStateException(\"Unsupported changelog task: \" + task.getClass().getName());\n}","typeGuard":"boolean isSupportedChangelogTask(ChangelogScanTask t) {\n  return t instanceof AddedRowsScanTask || t instanceof DeletedRowsScanTask || t instanceof DeletedDataFileScanTask;\n}","tryCatchPattern":"try { reader.openChangelogScanTask(task); } catch (IllegalArgumentException e) { /* inspect task class, fix jar versions */ }","preventionTips":["Keep all Iceberg modules at the same version","Run mvn/gradle dependency:tree to detect mixed iceberg jars","Test changelog reads after upgrades"],"tags":["spark","iceberg","illegal-argument","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"}