{"record":{"id":"7be894b5b813529d","repo":"apache/iceberg","slug":"unsupported-isolation-level","errorCode":null,"errorMessage":"Unsupported isolation level: ","messagePattern":"Unsupported isolation level: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkWrite.java","lineNumber":489,"sourceCode":"      for (DataFile file : files(messages)) {\n        numAddedFiles += 1;\n        overwriteFiles.addFile(file);\n      }\n\n      // the scan may be null if the optimizer replaces it with an empty relation (e.g. false cond)\n      // no validation is needed in this case as the command does not depend on the table state\n      if (scan != null) {\n        switch (isolationLevel) {\n          case SERIALIZABLE:\n            commitWithSerializableIsolation(\n                overwriteFiles, numOverwrittenFiles, numAddedFiles, summary);\n            break;\n          case SNAPSHOT:\n            commitWithSnapshotIsolation(\n                overwriteFiles, numOverwrittenFiles, numAddedFiles, summary);\n            break;\n          default:\n            throw new IllegalArgumentException(\"Unsupported isolation level: \" + isolationLevel);\n        }\n\n      } else {\n        commitOperation(\n            overwriteFiles,\n            String.format(\n                Locale.ROOT, \"overwrite with %d new data files (no validation)\", numAddedFiles),\n            summary);\n      }\n    }\n\n    private void commitWithSerializableIsolation(\n        OverwriteFiles overwriteFiles,\n        int numOverwrittenFiles,\n        int numAddedFiles,\n        WriteSummary summary) {\n      Long scanSnapshotId = scan.snapshotId();\n      if (scanSnapshotId != null) {","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkWrite.java#L471-L507","documentation":"SparkWrite.commit throws this IllegalArgumentException when the write is configured with an isolation level that the commit path does not recognize. Valid levels are none, serializable, and snapshot; anything else falls into the default branch of the switch on isolationLevel.","triggerScenarios":"Committing an overwrite/delete write whose IsolationLevel is neither Serializable nor Snapshot, i.e. a value outside the enum handled by the switch in SparkWrite.commit.","commonSituations":"Passing a custom or misparsed isolation level string via write options, code changes introducing a new IsolationLevel without updating SparkWrite, or deserializing stale state that carries an unknown level.","solutions":["Set the isolation level to one of the supported values: none, serializable, or snapshot (e.g. write.format.option(\"isolation-level\", \"serializable\"))","Check for typos or case mismatches in the isolation-level option string","If a new isolation level was added in code, update SparkWrite.commit to handle it explicitly"],"exampleFix":"// before\nbuilder.option(\"isolation-level\", \"repeatable-read\");\n// after\nbuilder.option(\"isolation-level\", \"serializable\");","handlingStrategy":"validation","validationCode":"// Java\nString level = conf.get(\"isolation-level\");\nif (!Arrays.asList(\"none\", \"serializable\", \"snapshot\").contains(level)) {\n  throw new IllegalArgumentException(\"isolation-level must be none|serializable|snapshot, got: \" + level);\n}","typeGuard":"boolean isSupportedIsolationLevel(String level) {\n  return level != null && (\"none\".equals(level) || \"serializable\".equals(level) || \"snapshot\".equals(level));\n}","tryCatchPattern":"try {\n  write.commit();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unsupported isolation level\")) {\n    // rewrite options with a supported level and retry\n  }\n  throw e;\n}","preventionTips":["Only pass none|serializable|snapshot as isolation-level","After upgrading Iceberg, review any custom isolation-level handling","Log effective write options before commit"],"tags":["spark","isolation-level","configuration"],"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"}