{"record":{"id":"0b78977ab3f6d590","repo":"apache/beam","slug":"failed-to-initialize-empty-deletefileindex","errorCode":null,"errorMessage":"Failed to initialize EMPTY DeleteFileIndex","messagePattern":"Failed to initialize EMPTY DeleteFileIndex","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/iceberg/src/main/java/org/apache/iceberg/BeamBaseIncrementalChangelogScan.java","lineNumber":79,"sourceCode":"public class BeamBaseIncrementalChangelogScan\n    extends BaseIncrementalScan<\n        IncrementalChangelogScan, ChangelogScanTask, ScanTaskGroup<ChangelogScanTask>>\n    implements IncrementalChangelogScan {\n  private static final DeleteFileIndex EMPTY = createEmptyInstance();\n\n  private static DeleteFileIndex createEmptyInstance() {\n    try {\n      var constructor =\n          DeleteFileIndex.class.getDeclaredConstructor(\n              DeleteFileIndex.EqualityDeletes.class,\n              PartitionMap.class,\n              PartitionMap.class,\n              Map.class,\n              Map.class);\n      constructor.setAccessible(true);\n      return constructor.newInstance(null, null, null, null, null);\n    } catch (Exception e) {\n      throw new RuntimeException(\"Failed to initialize EMPTY DeleteFileIndex\", e);\n    }\n  }\n\n  private static final Logger LOG = LoggerFactory.getLogger(BeamBaseIncrementalChangelogScan.class);\n\n  public BeamBaseIncrementalChangelogScan(Table table) {\n    this(table, table.schema(), TableScanContext.empty());\n  }\n\n  private BeamBaseIncrementalChangelogScan(Table table, Schema schema, TableScanContext context) {\n    super(table, schema, context);\n  }\n\n  @Override\n  protected IncrementalChangelogScan newRefinedScan(\n      Table newTable, Schema newSchema, TableScanContext newContext) {\n    return new BeamBaseIncrementalChangelogScan(newTable, newSchema, newContext);\n  }","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/iceberg/src/main/java/org/apache/iceberg/BeamBaseIncrementalChangelogScan.java#L61-L97","documentation":"createEmptyInstance builds an EMPTY DeleteFileIndex via a reflective constructor call on the Iceberg PartitionMap-backed index. Any failure of reflection (constructor signature change across Iceberg versions, class initialization error) is wrapped in this RuntimeException.","triggerScenarios":"Calling BeamBaseIncrementalChangelogScan.EMPTY (which calls createEmptyInstance) on an Iceberg runtime version whose DeleteFileIndex/PartitionMap constructor signature no longer matches the (PartitionMap.class, Map.class, Map.class...) shape invoked reflectively.","commonSituations":"Beam's iceberg module compiled against one Iceberg version but deployed with a different Iceberg on the classpath (version conflict); internal Iceberg API changed in a newer release.","solutions":["Align the Iceberg runtime version on the classpath with the version Beam's iceberg module was built against","Inspect the wrapped cause (e) to identify the exact reflection failure (NoSuchMethodException vs IncompatibleClassChangeError)","Upgrade or downgrade the org.apache.iceberg:iceberg-core dependency to a compatible version"],"exampleFix":"// before (pom.xml)\n<dependency><groupId>org.apache.iceberg</groupId><artifactId>iceberg-core</artifactId><version>1.6.0</version></dependency>\n// after\n<dependency><groupId>org.apache.iceberg</groupId><artifactId>iceberg-core</artifactId><version>1.4.3</version></dependency> <!-- match Beam's tested version -->","handlingStrategy":"try-catch","validationCode":"Class<?> idx = Class.forName(\"org.apache.iceberg.io.DeleteFileIndex\");\n// confirm constructor shape matches what Beam reflects on, at job-submission time","typeGuard":null,"tryCatchPattern":"try {\n  DeleteFileIndex idx = BeamBaseIncrementalChangelogScan.EMPTY;\n} catch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Failed to initialize EMPTY DeleteFileIndex\")) {\n    LOG.error(\"Iceberg runtime version mismatch: {}\", e.getCause(), e);\n    throw e;\n  }\n}","preventionTips":["Enforce a single org.apache.iceberg:iceberg-core version in your dependency tree (mvn dependency:tree, dependencyConvergence)","Use the Iceberg version documented by the Beam iceberg connector","Run a smoke test job at deploy time to catch reflection breakage early"],"tags":["iceberg","reflection","version-conflict"],"backgroundTag":"module-init-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}