{"record":{"id":"054f1484943ae2c5","repo":"aeron-io/aeron","slug":"already-in-snapshot","errorCode":null,"errorMessage":"already in snapshot","messagePattern":"already in snapshot","errorType":"exception","errorClass":"ClusterException","httpStatus":null,"severity":"error","filePath":"aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleSnapshotAdapter.java","lineNumber":105,"sourceCode":"            case SnapshotMarkerDecoder.TEMPLATE_ID:\n                snapshotMarkerDecoder.wrap(\n                    buffer,\n                    offset + MessageHeaderDecoder.ENCODED_LENGTH,\n                    messageHeaderDecoder.blockLength(),\n                    messageHeaderDecoder.version());\n\n                final long typeId = snapshotMarkerDecoder.typeId();\n                if (SNAPSHOT_TYPE_ID != typeId)\n                {\n                    throw new ClusterException(\"unexpected snapshot type: \" + typeId);\n                }\n\n                switch (snapshotMarkerDecoder.mark())\n                {\n                    case BEGIN:\n                        if (inSnapshot)\n                        {\n                            throw new ClusterException(\"already in snapshot\");\n                        }\n                        inSnapshot = true;\n\n                        listener.onLoadBeginSnapshot(\n                            snapshotMarkerDecoder.appVersion(),\n                            ClusterClock.map(snapshotMarkerDecoder.timeUnit()),\n                            buffer,\n                            offset,\n                            length);\n                        return Action.CONTINUE;\n\n                    case END:\n                        if (!inSnapshot)\n                        {\n                            throw new ClusterException(\"missing begin snapshot\");\n                        }\n                        listener.onLoadEndSnapshot(buffer, offset, length);\n                        isDone = true;","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleSnapshotAdapter.java#L87-L123","documentation":"A BEGIN snapshot marker arrived while the adapter is already inside a snapshot (inSnapshot == true). Snapshot streams must contain exactly one BEGIN/END pair; nested BEGINs indicate a corrupt or malformed snapshot stream.","triggerScenarios":"Replaying a recording that contains two consecutive BEGIN markers without an intervening END — typically a corrupted, duplicated, or wrongly spliced snapshot recording.","commonSituations":"Archive corruption or manual concatenation of recordings; replaying a partially written or wrongly cataloged recording as a snapshot; custom tooling appending extra snapshot entries.","solutions":["Restore from a verified backup snapshot recording","Inspect the recording with aeron-archive tooling to find spurious BEGIN markers","Re-take a snapshot on a healthy leader and restart from it","Remove manual edits/splices from the archive catalog"],"exampleFix":"// before: replaying a spliced/corrupt recording\nClusterException: already in snapshot\n// after\nRecordingArchive.verifySnapshot(recordingId); // or re-snapshot on a healthy leader, then load the new snapshot","handlingStrategy":"validation","validationCode":"// Sanity-check the recording is an intact single snapshot before replay\n// e.g. inspect first/last frames for a single BEGIN/END pair; verify recording length matches catalog","typeGuard":null,"tryCatchPattern":"try {\n    snapshotPlayer.load(recordingId, ...);\n} catch (ClusterException e) {\n    if (\"already in snapshot\".equals(e.getMessage())) {\n        // mark recording corrupt, restore from backup\n        restoreFromBackup();\n    } else { throw e; }\n}","preventionTips":["Never splice or hand-edit snapshot recordings","Verify archive checksums/integrity regularly","Always restore full recordings from backup, not partial segments"],"tags":["aeron","cluster","snapshot","corrupt-stream"],"backgroundTag":"invalid-state-transition","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}