apache/iceberg · error · IllegalArgumentException

Unknown manifest content: ${content}

Error message

Unknown manifest content: ${content}

What it means

RewriteManifestsSparkAction.loadManifests dispatches on the manifest content type and only handles DATA and DELETES manifests. Any other ManifestContent value (or a future/unknown enum value) reaches the default branch and throws IllegalArgumentException. This is a defensive guard since Iceberg manifests should only ever be data or deletes today.

Source

Thrown at spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteManifestsSparkAction.java:371

    if (currentSnapshot == null) {
      return ImmutableList.of();
    }

    List<ManifestFile> manifests = loadManifests(content, currentSnapshot);

    return manifests.stream()
        .filter(manifest -> manifest.partitionSpecId() == spec.specId() && predicate.test(manifest))
        .collect(Collectors.toList());
  }

  private List<ManifestFile> loadManifests(ManifestContent content, Snapshot snapshot) {
    switch (content) {
      case DATA:
        return snapshot.dataManifests(table.io());
      case DELETES:
        return snapshot.deleteManifests(table.io());
      default:
        throw new IllegalArgumentException("Unknown manifest content: " + content);
    }
  }

  private int targetNumManifests(long totalSizeBytes) {
    return (int) ((totalSizeBytes + targetManifestSizeBytes - 1) / targetManifestSizeBytes);
  }

  private long totalSizeBytes(Iterable<ManifestFile> manifests) {
    long totalSizeBytes = 0L;

    for (ManifestFile manifest : manifests) {
      ValidationException.check(
          hasFileCounts(manifest), "No file counts in manifest: %s", manifest.path());
      totalSizeBytes += manifest.length();
    }

    return totalSizeBytes;
  }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade the Spark Iceberg runtime to a version that recognizes the manifest content type present in the table
  2. Check the table's format version and manifests with Snapshots#allManifests to identify the unexpected content
  3. If caused by mixed-version writers, ensure all jobs use the same Iceberg runtime version
  4. Report the unrecognized content type if it comes from a supported spec version

Example fix

// before: running rewrite with old runtime on table with new manifest content
SparkActions.get(table).rewriteManifests().execute();
// after: align runtime version with writer version
// update spark-runtime jar to match the Iceberg version that wrote the manifests
Defensive patterns

Strategy: validation

Validate before calling

// before running rewrite
Table table = ...;
table.snapshots().forEach(s -> s.allManifests(table.io()).forEach(m -> {
  if (m.content() != ManifestContent.DATA && m.content() != ManifestContent.DELETES) {
    throw new IllegalStateException("Unexpected manifest content: " + m.content());
  }
}));

Type guard

if (content != ManifestContent.DATA && content != ManifestContent.DELETES) { return; }

Try / catch

try { actions.rewriteManifests().execute(); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Unknown manifest content")) { /* upgrade runtime */ } else { throw e; } }

Prevention

When it happens

Trigger: Calling RewriteManifestsSparkAction on a table whose snapshot returns a manifest with an unexpected content type — e.g. running against a table written by a newer Iceberg spec version that introduced a new manifest content type, or a corrupted/foreign manifest list.

Common situations: Upgrading/downgrading Iceberg versions across clusters where one version wrote manifest content types the other doesn't know; manually patched or third-party-written metadata pointing at unrecognized manifests.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/54b3caf36ff444a2. Report an issue: GitHub.