{"record":{"id":"9cab2dd3fdb6f854","repo":"apache/beam","slug":"unsupported-distribution-mode-distributionmode","errorCode":null,"errorMessage":"Unsupported distribution mode: {distributionMode}","messagePattern":"Unsupported distribution mode: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/IcebergIO.java","lineNumber":581,"sourceCode":"                      destinations,\n                      getTriggeringFrequency(),\n                      getDirectWriteByteLimit(),\n                      getWriteProperties()));\n        case HASH:\n          return input\n              .apply(\n                  \"AssignDestinationAndPartition\",\n                  new AssignDestinationsAndPartitions(destinations, getCatalogConfig()))\n              .apply(\n                  \"Write Rows to Partitions\",\n                  new WriteToPartitions(\n                      getCatalogConfig(),\n                      destinations,\n                      getTriggeringFrequency(),\n                      getAutoSharding(),\n                      getWriteProperties()));\n        default:\n          throw new UnsupportedOperationException(\n              \"Unsupported distribution mode: \" + getDistributionMode());\n      }\n    }\n  }\n\n  public static ReadRows readRows(IcebergCatalogConfig catalogConfig) {\n    return new AutoValue_IcebergIO_ReadRows.Builder()\n        .setCatalogConfig(catalogConfig)\n        .setUseCdc(false)\n        .setMetadataColumns(ImmutableList.of())\n        .build();\n  }\n\n  @AutoValue\n  public abstract static class ReadRows extends PTransform<PBegin, PCollection<Row>> {\n    public enum StartingStrategy {\n      EARLIEST,\n      LATEST","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/IcebergIO.java#L563-L599","documentation":"IcebergIO.WriteRows's expand dispatches on the configured distribution mode (NONE/HASH/ORDER, depending on version). When the mode does not match any implemented case, the default branch throws UnsupportedOperationException. This guards against a distribution mode value that is recognized by configuration but not implemented in the expansion logic.","triggerScenarios":"Building an IcebergIO write with a distribution mode not handled by the switch at IcebergIO.java:581, e.g. a mode set programmatically to a non-standard or newly added enum value.","commonSituations":"Upgrading Beam and enabling a newer distribution mode not supported by the deployed runner/version; setting distribution mode via generic config that admits values beyond the implemented ones; typos handled elsewhere but mode enum extended without updating expand().","solutions":["Set the write's distribution mode to a supported value (e.g. NONE or HASH) matching your Beam version.","Upgrade Beam to a version whose expand() implements the mode you need.","Remove the explicit distribution mode so the default/none path is used.","Check IcebergIO source for the switch cases to confirm supported modes."],"exampleFix":"// before\nwrite.withDistributionMode(DistributionMode.ORDER);\n\n// after\nwrite.withDistributionMode(DistributionMode.HASH); // or NONE","handlingStrategy":"validation","validationCode":"if (write.getDistributionMode() != DistributionMode.NONE\n    && write.getDistributionMode() != DistributionMode.HASH) {\n  throw new IllegalArgumentException(\"unsupported distribution mode\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  write.expand(rows);\n} catch (UnsupportedOperationException e) {\n  LOG.error(\"Unsupported distribution mode: {}\", e.getMessage());\n}","preventionTips":["Use only NONE or HASH distribution modes unless your Beam version documents more.","Re-check supported modes after Beam upgrades.","Let the writer use its default distribution mode.","Test write pipelines on the target runner version."],"tags":["java","iceberg","write","distribution-mode","unsupported-operation"],"backgroundTag":"unsupported-enum-value","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"}