{"record":{"id":"027b3242bf117b1c","repo":"apache/iceberg","slug":"unsupported-command-command-027b32","errorCode":null,"errorMessage":"Unsupported command: \" + command","messagePattern":"Unsupported command: \" \\+ command","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkRowLevelOperationBuilder.java","lineNumber":94,"sourceCode":"          new SparkPositionDeltaOperation(spark, table, snapshot, branch, info, isolationLevel);\n    };\n  }\n\n  private RowLevelOperationMode mode(Map<String, String> properties, Command command) {\n    String modeName;\n\n    switch (command) {\n      case DELETE:\n        modeName = properties.getOrDefault(DELETE_MODE, DELETE_MODE_DEFAULT);\n        break;\n      case UPDATE:\n        modeName = properties.getOrDefault(UPDATE_MODE, UPDATE_MODE_DEFAULT);\n        break;\n      case MERGE:\n        modeName = properties.getOrDefault(MERGE_MODE, MERGE_MODE_DEFAULT);\n        break;\n      default:\n        throw new IllegalArgumentException(\"Unsupported command: \" + command);\n    }\n\n    return RowLevelOperationMode.fromName(modeName);\n  }\n\n  private IsolationLevel isolationLevel(Map<String, String> properties, Command command) {\n    String levelName;\n\n    switch (command) {\n      case DELETE:\n        levelName = properties.getOrDefault(DELETE_ISOLATION_LEVEL, DELETE_ISOLATION_LEVEL_DEFAULT);\n        break;\n      case UPDATE:\n        levelName = properties.getOrDefault(UPDATE_ISOLATION_LEVEL, UPDATE_ISOLATION_LEVEL_DEFAULT);\n        break;\n      case MERGE:\n        levelName = properties.getOrDefault(MERGE_ISOLATION_LEVEL, MERGE_ISOLATION_LEVEL_DEFAULT);\n        break;","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkRowLevelOperationBuilder.java#L76-L112","documentation":"SparkRowLevelOperationBuilder.mode(Command) only supports the DELETE, UPDATE, and MERGE commands; any other command has no row-level mode configuration and fails with IllegalArgumentException. The mode is resolved from table properties like write.delete.mode / write.update.mode / write.merge.mode.","triggerScenarios":"mode() is called with a Command value outside the switch (DELETE/UPDATE/MERGE), e.g. a custom or future Spark Command type passed to the row-level operation builder.","commonSituations":"Third-party commands routed into Iceberg's row-level operation support; Spark version upgrades introducing new Command kinds; custom extensions calling the builder.","solutions":["Only invoke the builder for DELETE, UPDATE, or MERGE commands.","Add a case for the new command in SparkRowLevelOperationBuilder if extending support.","Check the Spark/Iceberg version pairing; a new Spark command may not yet be supported by this Iceberg version.","Set the appropriate write.<command>.mode table property for supported commands."],"exampleFix":"// before\nRowLevelOperationMode mode = builder.mode(anyCommand);\n// after\nif (command instanceof Delete || command instanceof Update || command instanceof MergeIntoTable) {\n  RowLevelOperationMode mode = builder.mode(command);\n}","handlingStrategy":"validation","validationCode":"Set<Command> supported = Set.of(Delete.class, Update.class, MergeIntoTable.class); if (!supported.contains(command.getClass())) throw new IllegalArgumentException(\"unsupported: \" + command);","typeGuard":"boolean supported = command instanceof Delete || command instanceof Update || command instanceof MergeIntoTable;","tryCatchPattern":"try { return builder.mode(command); } catch (IllegalArgumentException e) { return RowLevelOperationMode.COPY_ON_WRITE; }","preventionTips":["Only build row-level operations for DELETE/UPDATE/MERGE","Keep Iceberg and Spark versions aligned","Set write.<command>.mode table properties"],"tags":["invalid-argument","spark","row-level-operations"],"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-23T08:17:48.524Z"}