{"record":{"id":"a494fae5c234102d","repo":"apache/beam","slug":"unknown-scan-type","errorCode":null,"errorMessage":"Unknown scan type: {}","messagePattern":"Unknown scan type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/ScanSource.java","lineNumber":101,"sourceCode":"      case TABLE:\n        TableScan tableScan = getTableScan();\n        if (desiredBundleSizeBytes > 0) {\n          tableScan =\n              tableScan.option(TableProperties.SPLIT_SIZE, Long.toString(desiredBundleSizeBytes));\n        }\n\n        try (CloseableIterable<CombinedScanTask> tasks = tableScan.planTasks()) {\n          for (CombinedScanTask combinedScanTask : tasks) {\n            splits.add(new ScanTaskSource(scanConfig, combinedScanTask));\n          }\n        } catch (IOException e) {\n          throw new RuntimeException(e);\n        }\n        break;\n      case BATCH:\n        throw new UnsupportedOperationException(\"BATCH scan not supported\");\n      default:\n        throw new UnsupportedOperationException(\"Unknown scan type: \" + scanConfig.getScanType());\n    }\n\n    return splits;\n  }\n\n  @Override\n  public long getEstimatedSizeBytes(PipelineOptions options) throws Exception {\n    return wholeTableReadTask().sizeBytes();\n  }\n\n  @Override\n  public void populateDisplayData(DisplayData.Builder builder) {\n    super.populateDisplayData(builder);\n  }\n\n  @Override\n  public Coder<Row> getOutputCoder() {\n    return RowCoder.of(","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/ScanSource.java#L83-L119","documentation":"ScanSource.split() switches over the scan configuration's scan type and throws UnsupportedOperationException for any value it does not explicitly handle (neither TABLE nor BATCH). This is a defensive default branch indicating the ScanConfig carried an unknown or newly-added Iceberg scan type the connector doesn't recognize.","triggerScenarios":"scanConfig.getScanType() returns a value not covered by the switch cases in ScanSource.split(), e.g. a null, custom, or newer Iceberg ScanType enum value.","commonSituations":"Upgrading the Iceberg library introduced a new scan type the Beam connector version predates; a ScanConfig was built programmatically with a null/default scan type; a custom ScanType implementation was injected.","solutions":["Log/inspect scanConfig.getScanType() to see the unexpected value.","Fix the code that builds the ScanConfig so it sets a supported scan type (TABLE).","Align the Beam IO iceberg connector version with the Iceberg library version in use.","If a new scan type is legitimately needed, add a case for it in ScanSource.split()."],"exampleFix":"// before\nScanConfig cfg = ScanConfig.builder().build(); // scanType left unset\n// after\nScanConfig cfg = ScanConfig.builder().setScanType(ScanType.TABLE).build();","handlingStrategy":"validation","validationCode":"Object t = scanConfig.getScanType();\nif (t != ScanType.TABLE && t != ScanType.INCREMENTAL /* supported types */) {\n  throw new IllegalArgumentException(\"Unsupported scan type: \" + t);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return source.split(desiredBundles, options);\n} catch (UnsupportedOperationException e) {\n  throw new IllegalStateException(\"Unknown scan type — check ScanConfig construction and library version alignment\", e);\n}","preventionTips":["Always set scanType from the ScanType enum, never a raw/casted value.","Keep the Beam IO iceberg connector and the Iceberg library versions aligned so enum values match.","Assert scanType non-null at ScanConfig construction."],"tags":["iceberg","java","apache-beam","enum","unknown-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}