{"record":{"id":"a74b2011a2340419","repo":"apache/iceberg","slug":"cannot-process-unknown-snapshot-operation-s-sna-a74b20","errorCode":null,"errorMessage":"Cannot process unknown snapshot operation: %s (snapshot id %s)","messagePattern":"Cannot process unknown snapshot operation: (.+?) \\(snapshot id (.+?)\\)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/source/BaseSparkMicroBatchPlanner.java","lineNumber":76,"sourceCode":"        return true;\n      case DataOperations.REPLACE:\n        return false;\n      case DataOperations.DELETE:\n        Preconditions.checkState(\n            readConf.streamingSkipDeleteSnapshots(),\n            \"Cannot process delete snapshot: %s, to ignore deletes, set %s=true\",\n            snapshot.snapshotId(),\n            SparkReadOptions.STREAMING_SKIP_DELETE_SNAPSHOTS);\n        return false;\n      case DataOperations.OVERWRITE:\n        Preconditions.checkState(\n            readConf.streamingSkipOverwriteSnapshots(),\n            \"Cannot process overwrite snapshot: %s, to ignore overwrites, set %s=true\",\n            snapshot.snapshotId(),\n            SparkReadOptions.STREAMING_SKIP_OVERWRITE_SNAPSHOTS);\n        return false;\n      default:\n        throw new IllegalStateException(\n            String.format(\n                \"Cannot process unknown snapshot operation: %s (snapshot id %s)\",\n                op.toLowerCase(Locale.ROOT), snapshot.snapshotId()));\n    }\n  }\n\n  /**\n   * Get the next snapshot skipping over rewrite and delete snapshots. Async must handle nulls.\n   *\n   * @param curSnapshot the current snapshot\n   * @return the next valid snapshot (not a rewrite or delete snapshot), returns null if all\n   *     remaining snapshots should be skipped.\n   */\n  protected Snapshot nextValidSnapshot(Snapshot curSnapshot) {\n    Snapshot nextSnapshot;\n    // if there were no valid snapshots, check for an initialOffset again\n    if (curSnapshot == null) {\n      StreamingOffset startingOffset =","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/source/BaseSparkMicroBatchPlanner.java#L58-L94","documentation":"BaseSparkMicroBatchPlanner.shouldProcess throws this IllegalStateException in the default branch of the snapshot-operation switch, meaning a snapshot's operation is not one of the recognized streaming operations (append, overwrite, delete, replace, etc.). It guards against the snapshot summary exposing an operation this planner version does not understand.","triggerScenarios":"nextValidSnapshot encounters a snapshot whose SnapshotSummary operation (case-insensitively) matches no known enum value, e.g. produced by a newer Iceberg writer version or a corrupted/foreign snapshot.","commonSituations":"A table written by a newer Iceberg version introducing a new snapshot operation is read by an older Spark integration; tables written by non-Iceberg tooling injecting unusual snapshots.","solutions":["Upgrade the Iceberg runtime to a version that recognizes the new snapshot operation","Inspect snapshot.operation in the offending snapshot summary to identify the producer","Check for external tools writing snapshots to the table","If the operation is legitimate and should be skipped, track/report an Iceberg issue rather than bypassing"],"exampleFix":"// before\n// reading a table with a new operation on an old runtime\n// after\n// upgrade dependency\nimplementation(\"org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:latest\")","handlingStrategy":"validation","validationCode":"Set<Operation> known = Set.of(Operation.APPEND, Operation.OVERWRITE, Operation.DELETE, Operation.REPLACE);\nif (!known.contains(snapshot.operation())) throw new IllegalStateException(\"unsupported op: \" + snapshot.operation());","typeGuard":"boolean isKnown(Operation op) { return op == Operation.APPEND || op == Operation.OVERWRITE || op == Operation.DELETE || op == Operation.REPLACE; }","tryCatchPattern":null,"preventionTips":["Keep Iceberg writer and reader versions aligned","Audit tables written by external tooling before streaming from them","Check snapshot.operation summaries before enabling streaming"],"tags":["spark","streaming","snapshot","state"],"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"}