{"record":{"id":"d554a0e075d30bef","repo":"apache/iceberg","slug":"unknown-manifest-content-content-d554a0","errorCode":null,"errorMessage":"Unknown manifest content: ${content}","messagePattern":"Unknown manifest content: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteManifestsSparkAction.java","lineNumber":371,"sourceCode":"    if (currentSnapshot == null) {\n      return ImmutableList.of();\n    }\n\n    List<ManifestFile> manifests = loadManifests(content, currentSnapshot);\n\n    return manifests.stream()\n        .filter(manifest -> manifest.partitionSpecId() == spec.specId() && predicate.test(manifest))\n        .collect(Collectors.toList());\n  }\n\n  private List<ManifestFile> loadManifests(ManifestContent content, Snapshot snapshot) {\n    switch (content) {\n      case DATA:\n        return snapshot.dataManifests(table.io());\n      case DELETES:\n        return snapshot.deleteManifests(table.io());\n      default:\n        throw new IllegalArgumentException(\"Unknown manifest content: \" + content);\n    }\n  }\n\n  private int targetNumManifests(long totalSizeBytes) {\n    return (int) ((totalSizeBytes + targetManifestSizeBytes - 1) / targetManifestSizeBytes);\n  }\n\n  private long totalSizeBytes(Iterable<ManifestFile> manifests) {\n    long totalSizeBytes = 0L;\n\n    for (ManifestFile manifest : manifests) {\n      ValidationException.check(\n          hasFileCounts(manifest), \"No file counts in manifest: %s\", manifest.path());\n      totalSizeBytes += manifest.length();\n    }\n\n    return totalSizeBytes;\n  }","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteManifestsSparkAction.java#L353-L389","documentation":"RewriteManifestsSparkAction.loadManifests selects manifest lists from a snapshot by manifest content type (DATA or DELETES). If the snapshot's ManifestContent enum is anything else, it throws IllegalArgumentException. In practice this only occurs with future/unknown content types from a newer spec version.","triggerScenarios":"Calling RewriteManifestsSparkAction.execute() on a table whose snapshot contains a manifest with a content type other than DATA or DELETES (e.g. written by a newer Iceberg spec with an added content type).","commonSituations":"Reading tables produced by a newer Iceberg version with an older Spark runtime; corrupted or hand-edited metadata assigning an unexpected content value.","solutions":["Upgrade the Spark Iceberg runtime to match (or exceed) the version that wrote the table metadata.","Rewrite from a snapshot/version that only contains DATA and DELETES manifests (rollback or rewrite from an earlier version).","Check the table's snapshots for unexpected manifest content with SparkActions before running rewrite."],"exampleFix":"// before\nsparkActions.rewriteManifests(table).execute();\n// after\n// upgrade runtime first, then:\nsparkActions.rewriteManifests(table).useSnapshotId(validSnapshotId).execute();","handlingStrategy":"type-guard","validationCode":"boolean ok = table.currentSnapshot() == null || table.currentSnapshot().allManifests(table.io()).stream().allMatch(m -> m.content() == ManifestContent.DATA || m.content() == ManifestContent.DELETES);","typeGuard":"if (manifest.content() != ManifestContent.DATA && manifest.content() != ManifestContent.DELETES) { throw new IllegalArgumentException(...); }","tryCatchPattern":"try { action.execute(); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unknown manifest content\")) { /* upgrade runtime / use different snapshot */ } else throw e; }","preventionTips":["Keep the Spark runtime version aligned with the version that writes the table metadata","Avoid mixing Iceberg runtime versions against tables written by newer releases"],"tags":["spark","rewrite-manifests","unsupported-type"],"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-14T16:17:12.679Z"}