{"record":{"id":"64febc65ed3edaa2","repo":"apache/cassandra","slug":"unable-to-serialize-metadata-snapshot-triggered-by","errorCode":null,"errorMessage":"Unable to serialize metadata snapshot triggered by TriggerSnapshot transformation","messagePattern":"Unable to serialize metadata snapshot triggered by TriggerSnapshot transformation","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/tcm/listeners/MetadataSnapshotListener.java","lineNumber":52,"sourceCode":"public class MetadataSnapshotListener implements LogListener\n{\n    private static final Logger logger = LoggerFactory.getLogger(MetadataSnapshotListener.class);\n\n    private static final EnumSet<Transformation.Kind> triggers = EnumSet.of(TRIGGER_SNAPSHOT, FORCE_SNAPSHOT);\n\n    @Override\n    public void notify(Entry entry, Transformation.Result result)\n    {\n        ClusterMetadata next = result.success().metadata;\n        if (triggers.contains(entry.transform.kind()))\n        {\n            try\n            {\n                ClusterMetadataService.instance().snapshotManager().storeSnapshot(next);\n            }\n            catch (Throwable e)\n            {\n                logger.warn(\"Unable to serialize metadata snapshot triggered by TriggerSnapshot transformation\", e);\n            }\n        }\n    }\n}\n","sourceCodeStart":34,"sourceCodeEnd":57,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/listeners/MetadataSnapshotListener.java#L34-L57","documentation":"MetadataSnapshotListener.notify tries to persist a cluster metadata snapshot via ClusterMetadataService.instance().snapshotManager().storeSnapshot(next) when a TriggerSnapshot transformation is applied. Serialization/persistence failures are caught and logged as a warning; the epoch is committed anyway, so only snapshot capture is lost.","triggerScenarios":"A TriggerSnapshot transformation is committed on the CMS and storeSnapshot throws while serializing the ClusterMetadata (e.g. a transformation result that cannot be serialized, disk I/O failure on the snapshot directory, or internal serialization bug in a newly added metadata type).","commonSituations":"Upgrades introducing new metadata fields not serializable by older snapshot code; disk full or permissions on the snapshots directory; test environments (forceSnapshotTriggersSnapshot) where listeners run against partially constructed metadata.","solutions":["Check the logged Throwable stack for the root cause (IOException vs serialization class error).","Verify disk space and write permissions on the CMS snapshot directory.","If a new metadata type fails to serialize, ensure all nodes run compatible versions and the type has a registered serialization codec.","Retry snapshot capture manually (or via another TriggerSnapshot) once the root cause is fixed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure snapshot dir is writable before triggering\nFile dir = DatabaseDescriptor.getSnapshotDirectory();\nif (!dir.canWrite()) throw new IllegalStateException(\"Snapshot dir not writable: \" + dir);","typeGuard":null,"tryCatchPattern":"try {\n    ClusterMetadataService.instance().snapshotManager().storeSnapshot(next);\n} catch (IOException | SerializationException e) {\n    logger.warn(\"Snapshot capture failed; will retry on next trigger\", e);\n}","preventionTips":["Monitor disk space on snapshot directories.","Keep cluster versions aligned before taking snapshots.","Alert on this warning since the epoch commits without a snapshot."],"tags":["tcm","snapshot","serialization","metadata"],"backgroundTag":"json-marshal-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}