{"record":{"id":"1051649a8c5d4776","repo":"apache/iceberg","slug":"unsupported-command-command-105164","errorCode":null,"errorMessage":"Unsupported command: + command","messagePattern":"Unsupported command: \\+ command","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkRowLevelOperationBuilder.java","lineNumber":89,"sourceCode":"        throw new IllegalArgumentException(\"Unsupported operation mode: \" + mode);\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":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkRowLevelOperationBuilder.java#L71-L107","documentation":"The mode() helper in SparkRowLevelOperationBuilder reads the write.*.mode table property keyed by the command type (DELETE, UPDATE, MERGE). If the incoming RowLevelOperation command is none of these, the switch's default branch throws this IllegalArgumentException because there is no mode property defined for it.","triggerScenarios":"build() calls mode(properties, command) with a Command implementation that is not DELETE, UPDATE, or MERGE — e.g. a custom or newly introduced Spark row-level command not yet handled by this builder.","commonSituations":"Running newer Spark commands against an older iceberg-spark module that lacks the case; custom RowLevelOperation subclasses; internal API misuse.","solutions":["Upgrade iceberg-spark to a version that supports the command being executed.","Use only DELETE, UPDATE, or MERGE commands with this row-level operation builder.","If adding a new command, add a case to the switch mapping it to its write.*.mode property.","Verify which command reaches the builder via the query plan if unsure."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if (!(command instanceof Delete) && !(command instanceof Update) && !(command instanceof Merge)) {\n  throw new IllegalArgumentException(\"Command not supported by Iceberg row-level ops: \" + command);\n}","typeGuard":"boolean supported(Command c) { return c instanceof Delete || c instanceof Update || c instanceof Merge; }","tryCatchPattern":"try { RowLevelOperation op = builder.build(); } catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unsupported command\")) { throw new IllegalStateException(\"Upgrade iceberg-spark for this command\", e); }\n  throw e;\n}","preventionTips":["Only run DELETE/UPDATE/MERGE through the builder","Upgrade iceberg-spark when adopting new Spark row-level commands","Pin Spark and Iceberg versions together"],"tags":["spark","row-level-operations","configuration"],"backgroundTag":"unsupported-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}