{"record":{"id":"edfc59700724a4ac","repo":"apache/iceberg","slug":"failed-to-create-iceberg-input-splits-for-table","errorCode":null,"errorMessage":"Failed to create iceberg input splits for table: ","messagePattern":"Failed to create iceberg input splits for table: ","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/source/FlinkSource.java","lineNumber":295,"sourceCode":"\n    public DataStream<RowData> build() {\n      Preconditions.checkNotNull(env, \"StreamExecutionEnvironment should not be null\");\n      FlinkInputFormat format = buildFormat();\n\n      ScanContext context = contextBuilder.build();\n      TypeInformation<RowData> typeInfo =\n          FlinkCompatibilityUtil.toTypeInfo(FlinkSchemaUtil.convert(context.project()));\n\n      if (!context.isStreaming()) {\n        int parallelism =\n            SourceUtil.inferParallelism(\n                readableConfig,\n                context.limit(),\n                () -> {\n                  try {\n                    return format.createInputSplits(0).length;\n                  } catch (IOException e) {\n                    throw new UncheckedIOException(\n                        \"Failed to create iceberg input splits for table: \" + table, e);\n                  }\n                });\n        if (env.getMaxParallelism() > 0) {\n          parallelism = Math.min(parallelism, env.getMaxParallelism());\n        }\n        return env.createInput(format, typeInfo).setParallelism(parallelism);\n      } else {\n        StreamingMonitorFunction function = new StreamingMonitorFunction(tableLoader, context);\n\n        String monitorFunctionName = String.format(\"Iceberg table (%s) monitor\", table);\n        String readerOperatorName = String.format(\"Iceberg table (%s) reader\", table);\n\n        return env.addSource(function, monitorFunctionName)\n            .transform(readerOperatorName, typeInfo, StreamingReaderOperator.factory(format));\n      }\n    }\n  }","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/source/FlinkSource.java#L277-L313","documentation":"FlinkSource.build uses format.createInputSplits(0) to estimate split count for auto parallelism; any IOException while creating those splits is wrapped in UncheckedIOException naming the table. This means the underlying Iceberg scan/file IO failed (usually filesystem access, snapshot resolution, or manifest reading) during source construction.","triggerScenarios":"Calling FlinkSource.forRowData().project(...).build() where the table's FileIO cannot read metadata/manifests, the table location is wrong or credentials are missing, or the snapshot referenced no longer exists.","commonSituations":"Misconfigured S3/HDFS credentials or endpoint, table path typo, snapshot expired between planning and build, network outage to object store, read permission denied on metadata files.","solutions":["Verify table name/path resolves and FileIO credentials are configured (e.g. s3.access-key, hadoop conf)","Check the referenced snapshot still exists (not expired); set a valid snapshot-id or refresh the table","Test reading the table outside Flink (Spark/iceberg inspect) to isolate Flink config issues","Inspect the chained IOException cause for the actual IO failure (permissions, DNS, timeout)"],"exampleFix":"// before\nFlinkSource.forRowData().env(env).tableLoader(loader).build();\n// after: validate table is readable before building\nTable table = loader.loadTable();\ntable.refresh();\ntable.currentSnapshot(); // throws if metadata unreadable\nFlinkSource.forRowData().env(env).tableLoader(loader).build();","handlingStrategy":"try-catch","validationCode":"Table t = tableLoader.loadTable();\nt.refresh();\nPreconditions.checkState(t.currentSnapshot() != null, \"Table has no readable snapshot\");","typeGuard":null,"tryCatchPattern":"try {\n  source = FlinkSource.forRowData().env(env).tableLoader(loader).build();\n} catch (UncheckedIOException e) {\n  throw new RuntimeException(\"Cannot read table \" + e.getCause().getMessage(), e);\n}","preventionTips":["Validate FileIO credentials and table path before submitting the job","Pin snapshot-id if expiration jobs run concurrently","Confirm table readability with a small scan outside Flink first"],"tags":["flink","source","io","filesystem","parallelism"],"backgroundTag":"file-read-failed","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"}