{"record":{"id":"2f10ce8a40324453","repo":"aeron-io/aeron","slug":"recording-stopped-unexpectedly-recordingid","errorCode":null,"errorMessage":"recording stopped unexpectedly: ${recordingId}","messagePattern":"recording stopped unexpectedly: (.+?)","errorType":"console","errorClass":"ClusterException","httpStatus":null,"severity":"critical","filePath":"aeron-cluster/src/main/java/io/aeron/cluster/service/ClusteredServiceAgent.java","lineNumber":1036,"sourceCode":"        }\n    }\n\n    private void awaitRecordingComplete(\n        final long recordingId,\n        final long position,\n        final CountersReader counters,\n        final int counterId,\n        final AeronArchive archive)\n    {\n        idleStrategy.reset();\n        while (counters.getCounterValue(counterId) < position)\n        {\n            idle();\n            archive.checkForErrorResponse();\n\n            if (!RecordingPos.isActive(counters, counterId, recordingId))\n            {\n                throw new ClusterException(\"recording stopped unexpectedly: \" + recordingId);\n            }\n        }\n    }\n\n    private void snapshotState(\n        final ExclusivePublication publication, final long logPosition, final long leadershipTermId)\n    {\n        final ServiceSnapshotTaker snapshotTaker = new ServiceSnapshotTaker(\n            publication, idleStrategy, aeronAgentInvoker);\n\n        snapshotTaker.markBegin(SNAPSHOT_TYPE_ID, logPosition, leadershipTermId, 0, timeUnit, ctx.appVersion());\n\n        for (int i = 0, size = sessions.size(); i < size; i++)\n        {\n            snapshotTaker.snapshotSession(sessions.get(i));\n        }\n\n        snapshotTaker.markEnd(SNAPSHOT_TYPE_ID, logPosition, leadershipTermId, 0, timeUnit, ctx.appVersion());","sourceCodeStart":1018,"sourceCodeEnd":1054,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-cluster/src/main/java/io/aeron/cluster/service/ClusteredServiceAgent.java#L1018-L1054","documentation":"Thrown as ClusterException while a leader records a snapshot: the RecordingPos counter for the archive recording stopped being active before the recording reached the expected position, i.e. the archive recording ended unexpectedly instead of completing the snapshot.","triggerScenarios":"While awaiting snapshot recording completion, RecordingPos.isActive(counters, counterId, recordingId) returns false before the recording position reaches the target; archive stopped the recording; recording failed mid-stream; archive reached its max capacity or was restarted.","commonSituations":"Media driver or archive crash during snapshot; snapshot publication failure causing the recorder to abort; archive configuration (recording events) removed the counter; disk full on the archive host.","solutions":["Check archive and driver error logs for why the recording aborted","Ensure the archive has sufficient disk space and correct recording configuration","Retry the snapshot (take a new one) after fixing the archive state","Verify catalog/recording log integrity if the recording was marked complete prematurely"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!RecordingPos.isActive(counters, counterId, recordingId)) {\n    throw new IllegalStateException(\"recording \" + recordingId + \" not active before reaching target position\");\n}","typeGuard":null,"tryCatchPattern":"try { awaitRecordingPosition(recordingId, targetPos); }\ncatch (ClusterException ex) { /* re-trigger snapshot after verifying archive health */ }","preventionTips":["Alert on RecordingPos counter activity during snapshots","Ensure adequate disk space and archive capacity","Check archive logs on every aborted snapshot before retrying"],"tags":["aeron","archive","snapshot","recording"],"backgroundTag":"unexpected-response-shape","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}