apache/iceberg · warning

Failed to convert current snapshot

Error message

Failed to convert current snapshot({}) summary to a json string

What it means

HMSTablePropertyHelper.setSnapshotSummary fails to serialize the current snapshot summary map to JSON with Jackson; the JsonProcessingException is caught, logged with this warning (including the exception), and the summary property is simply not written to HMS parameters. The commit continues.

Solutions

  1. Inspect the logged JsonProcessingException to find the non-serializable value
  2. Ensure snapshot summary values are plain strings/serializable types
  3. Check Jackson version conflicts (iceberg bundles its own jackson — avoid shading mismatches)
  4. If harmless, ignore: only the HMS-exposed summary is skipped
Defensive patterns

Strategy: try-catch

Validate before calling

ObjectMapper mapper = JsonUtil.mapper();
mapper.writeValueAsString(snapshot.summary()); // throws if unserializable

Try / catch

try { mapper.writeValueAsString(summary); } catch (JsonProcessingException e) { LOG.warn("summary not serializable: {}", e.getMessage()); }

Prevention

When it happens

Trigger: JsonUtil.mapper().writeValueAsString(currentSnapshot.summary()) throws — e.g. an unexpected object type inside the summary map that Jackson cannot serialize (non-String values added by extensions), or a custom mapper configuration issue.

Common situations: Custom snapshot summary producers injecting non-JSON-serializable values; broken/odd Jackson versions on the classpath; subclassed Snapshot implementations returning unusual summary values.

Understand the failure class

Background: "JSON serialization failed", "not JSON serializable", "Failed to serialize": why JSON marshaling errors happen and how to fix them — this error's family across 46 libraries.

Related errors


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

Appendix: source

Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java:233

    parameters.put(TableProperties.SNAPSHOT_COUNT, String.valueOf(metadata.snapshots().size()));
  }

  @VisibleForTesting
  static void setSnapshotSummary(
      Map<String, String> parameters, Snapshot currentSnapshot, long maxHiveTablePropertySize) {
    try {
      String summary = JsonUtil.mapper().writeValueAsString(currentSnapshot.summary());
      if (summary.length() <= maxHiveTablePropertySize) {
        parameters.put(TableProperties.CURRENT_SNAPSHOT_SUMMARY, summary);
      } else {
        LOG.warn(
            "Not exposing the current snapshot({}) summary in HMS since it exceeds {} characters",
            currentSnapshot.snapshotId(),
            maxHiveTablePropertySize);
      }
    } catch (JsonProcessingException e) {
      LOG.warn(
          "Failed to convert current snapshot({}) summary to a json string",
          currentSnapshot.snapshotId(),
          e);
    }
  }

  @VisibleForTesting
  static void setPartitionSpec(
      TableMetadata metadata, Map<String, String> parameters, long maxHiveTablePropertySize) {
    parameters.remove(TableProperties.DEFAULT_PARTITION_SPEC);
    if (exposeInHmsProperties(maxHiveTablePropertySize)
        && metadata.spec() != null
        && metadata.spec().isPartitioned()) {
      String spec = PartitionSpecParser.toJson(metadata.spec());
      setField(parameters, TableProperties.DEFAULT_PARTITION_SPEC, spec, maxHiveTablePropertySize);
    }
  }

View on GitHub (pinned to 86d9c8fc54)