{"record":{"id":"8c6947550f3edc84","repo":"apache/iceberg","slug":"unsupported-command-command-8c6947","errorCode":null,"errorMessage":"Unsupported command: ${command}","messagePattern":"Unsupported command: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/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.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkRowLevelOperationBuilder.java#L76-L112","documentation":"SparkRowLevelOperationBuilder.mode() resolves the row-level operation mode (copy-on-write vs merge-on-read) from table properties for a given command (DELETE, UPDATE, MERGE). If the command is not one of the recognized enum values, it throws IllegalArgumentException('Unsupported command: ...'). This is an internal dispatch guard: the caller must pass a supported Command.","triggerScenarios":"Calling SparkRowLevelOperationBuilder (or the row-level operation path) with a Command value other than DELETE, UPDATE, or MERGE, e.g. a newly added Spark command not yet handled by the switch in mode().","commonSituations":"Running a new Spark write command (e.g. REPLACE or a custom operation) against an Iceberg table where the Spark integration hasn't implemented the corresponding mode lookup; internal version skew between Spark extension code and the Command enum.","solutions":["Check which Command value reached mode(); only DELETE, UPDATE, and MERGE are supported","Upgrade Iceberg Spark runtime to a version that handles the command you issued","If the command comes from custom code, pass one of the supported Command values or extend mode() with a new case","Verify the Spark-Iceberg version pairing matches the docs; mismatched jars can introduce unhandled commands"],"exampleFix":"// before\nRowLevelOperationMode m = builder.mode(Command.valueOf(\"REPLACE\")); // throws\n// after\nRowLevelOperationMode m = builder.mode(Command.MERGE); // use a supported command","handlingStrategy":"validation","validationCode":"if (command != Command.DELETE && command != Command.UPDATE && command != Command.MERGE) { throw new IllegalArgumentException(\"Command not supported by Iceberg row-level ops: \" + command); }","typeGuard":null,"tryCatchPattern":"try { mode = builder.mode(command); } catch (IllegalArgumentException e) { log.error(\"Unsupported row-level command\", e); throw new QueryUnsupportedException(e.getMessage()); }","preventionTips":["Only issue DELETE/UPDATE/MERGE statements through the Iceberg Spark extension","Keep the Iceberg Spark runtime version aligned with your Spark version","When extending commands, add a case to mode() before dispatching"],"tags":["spark","iceberg","illegal-argument","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-14T16:17:12.679Z"}