{"record":{"id":"d9a4ad1734b49296","repo":"aeron-io/aeron","slug":"missing-begin-snapshot-servicesnapshotloader","errorCode":null,"errorMessage":"missing begin snapshot","messagePattern":"missing begin snapshot","errorType":"console","errorClass":"ClusterException","httpStatus":null,"severity":"critical","filePath":"aeron-cluster/src/main/java/io/aeron/cluster/service/ServiceSnapshotLoader.java","lineNumber":112,"sourceCode":"                    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                        appVersion = snapshotMarkerDecoder.appVersion();\n                        timeUnit = ClusterClock.map(snapshotMarkerDecoder.timeUnit());\n                        return Action.CONTINUE;\n\n                    case END:\n                        if (!inSnapshot)\n                        {\n                            throw new ClusterException(\"missing begin snapshot\");\n                        }\n                        isDone = true;\n                        return Action.BREAK;\n\n                    case SECTION:\n                    case NULL_VAL:\n                        break;\n                }\n                break;\n\n            case ClientSessionDecoder.TEMPLATE_ID:\n                clientSessionDecoder.wrap(\n                    buffer,\n                    offset + MessageHeaderDecoder.ENCODED_LENGTH,\n                    messageHeaderDecoder.blockLength(),\n                    messageHeaderDecoder.version());\n\n                final String responseChannel = clientSessionDecoder.responseChannel();","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-cluster/src/main/java/io/aeron/cluster/service/ServiceSnapshotLoader.java#L94-L130","documentation":"An END snapshot marker was received while no BEGIN marker had been seen, meaning the stream started mid-snapshot. The loader requires the full marker protocol (BEGIN ... sections ... END); an END without a matching BEGIN means snapshot data is incomplete and cannot be trusted, so it aborts recovery.","triggerScenarios":"onFragment receives a SnapshotMarker with mark=END while inSnapshot is false — the first decoded marker was not BEGIN (e.g. replay started after the BEGIN frame or the BEGIN frame was lost/corrupt).","commonSituations":"Replaying a recording from a wrong starting position (offset past the BEGIN marker), truncated recording that lost the initial frame, or loading only the tail of a snapshot.","solutions":["Replay the snapshot recording from position 0 so the BEGIN marker is included","Re-take the snapshot from a healthy cluster member","Verify the archive replay channel/stream-id and recording start position configuration"],"exampleFix":"// before: replay from stored (wrong) offset\nreplayParams.position(snapshotTailPosition);\n// after: replay the whole snapshot recording\nreplayParams.position(0L);","handlingStrategy":"validation","validationCode":"// Replay snapshots from their start position so BEGIN is the first marker\nreplayParams.position(0L);","typeGuard":null,"tryCatchPattern":"try { loader.load(...); } catch (ClusterException e) { abortRecovery(e); }","preventionTips":["Always replay the full snapshot recording","Avoid saving/reusing tail offsets from prior partial replays","Verify recordings are not truncated via archive catalog checks"],"tags":["aeron-cluster","snapshot","state-machine","incomplete-data"],"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-15T23:17:13.987Z"}