{"record":{"id":"b7e6be09a4d12b40","repo":"apache/iceberg","slug":"failed-to-convert-current-snapshot-summary-to","errorCode":null,"errorMessage":"Failed to convert current snapshot({}) summary to a json string","messagePattern":"Failed to convert current snapshot\\((.+?)\\) summary to a json string","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java","lineNumber":233,"sourceCode":"\n    parameters.put(TableProperties.SNAPSHOT_COUNT, String.valueOf(metadata.snapshots().size()));\n  }\n\n  @VisibleForTesting\n  static void setSnapshotSummary(\n      Map<String, String> parameters, Snapshot currentSnapshot, long maxHiveTablePropertySize) {\n    try {\n      String summary = JsonUtil.mapper().writeValueAsString(currentSnapshot.summary());\n      if (summary.length() <= maxHiveTablePropertySize) {\n        parameters.put(TableProperties.CURRENT_SNAPSHOT_SUMMARY, summary);\n      } else {\n        LOG.warn(\n            \"Not exposing the current snapshot({}) summary in HMS since it exceeds {} characters\",\n            currentSnapshot.snapshotId(),\n            maxHiveTablePropertySize);\n      }\n    } catch (JsonProcessingException e) {\n      LOG.warn(\n          \"Failed to convert current snapshot({}) summary to a json string\",\n          currentSnapshot.snapshotId(),\n          e);\n    }\n  }\n\n  @VisibleForTesting\n  static void setPartitionSpec(\n      TableMetadata metadata, Map<String, String> parameters, long maxHiveTablePropertySize) {\n    parameters.remove(TableProperties.DEFAULT_PARTITION_SPEC);\n    if (exposeInHmsProperties(maxHiveTablePropertySize)\n        && metadata.spec() != null\n        && metadata.spec().isPartitioned()) {\n      String spec = PartitionSpecParser.toJson(metadata.spec());\n      setField(parameters, TableProperties.DEFAULT_PARTITION_SPEC, spec, maxHiveTablePropertySize);\n    }\n  }\n","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java#L215-L251","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom snapshot summary producers injecting non-JSON-serializable values; broken/odd Jackson versions on the classpath; subclassed Snapshot implementations returning unusual summary values.","solutions":["Inspect the logged JsonProcessingException to find the non-serializable value","Ensure snapshot summary values are plain strings/serializable types","Check Jackson version conflicts (iceberg bundles its own jackson — avoid shading mismatches)","If harmless, ignore: only the HMS-exposed summary is skipped"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"ObjectMapper mapper = JsonUtil.mapper();\nmapper.writeValueAsString(snapshot.summary()); // throws if unserializable","typeGuard":null,"tryCatchPattern":"try { mapper.writeValueAsString(summary); } catch (JsonProcessingException e) { LOG.warn(\"summary not serializable: {}\", e.getMessage()); }","preventionTips":["Only put String values into snapshot summaries","Avoid shading conflicting Jackson versions","Test summary serialization with your custom producers","Keep Iceberg's bundled Jackson dependency intact"],"tags":["hive-metastore","json","serialization","snapshot-summary"],"backgroundTag":"json-serialization-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}