{"record":{"id":"8a32602e876ddae8","repo":"aeron-io/aeron","slug":"failed-to-send-replay-token-request","errorCode":null,"errorMessage":"failed to send replay token request","messagePattern":"failed to send replay token request","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java","lineNumber":4241,"sourceCode":"                    resultException = ex;\n                }\n            }\n        }\n\n        return resultException;\n    }\n\n    private Subscription replayViaResponseChannel(\n        final long recordingId,\n        final String replayChannel,\n        final int replayStreamId,\n        final ReplayParams replayParams)\n    {\n        lastCorrelationId = aeron.nextCorrelationId();\n\n        if (!archiveProxy.requestReplayToken(lastCorrelationId, controlSessionId, recordingId))\n        {\n            throw new ArchiveException(\"failed to send replay token request\");\n        }\n\n        final long replayToken = pollForResponse(lastCorrelationId);\n\n        replayParams.replayToken(replayToken);\n        final Subscription replaySubscription = aeron.addSubscription(replayChannel, replayStreamId);\n        final ChannelUriStringBuilder uriBuilder = new ChannelUriStringBuilder(context.controlRequestChannel())\n            .sessionId((Integer)null)\n            .responseCorrelationId(replaySubscription.registrationId())\n            .termId((Integer)null).initialTermId((Integer)null).termOffset((Integer)null)\n            .termLength(64 * 1024)\n            .spiesSimulateConnection(false);\n\n        final String channel = uriBuilder.build();\n\n        try (ExclusivePublication publication =\n            aeron.addExclusivePublication(channel, context().controlRequestStreamId()))\n        {","sourceCodeStart":4223,"sourceCodeEnd":4259,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java#L4223-L4259","documentation":"Thrown by AeronArchive.startReplay when the client cannot offer a replay-token request on the archive control publication. The replay token lets the replay be authorized on a separate (response) channel; without successfully sending the request no token is issued. The offer failed because the control publication is CLOSED or NOT_CONNECTED.","triggerScenarios":"Calling startReplay with ReplayParams while the control request publication is closed or no longer connected to the archive (archive down, session invalid, channel misconfigured).","commonSituations":"Archive restarted between connect and replay; control channel misconfigured; long-lived AeronArchive whose control session's publication was closed by timeout; network drop during replay setup.","solutions":["Re-establish the AeronArchive session (reconnect) and retry startReplay","Verify the control request channel/stream match the running archive","Check archive availability and logs at the time of the call","Inspect the Aeron driver error log (aeron.error.log) for publication closure reasons"],"exampleFix":"// before\narchive.startReplay(recordingId, channel, streamId, replayParams); // throws\n// after\ntry {\n    archive.startReplay(recordingId, channel, streamId, replayParams);\n} catch (ArchiveException e) {\n    archive.close();\n    archive = AeronArchive.connect(ctx);\n    archive.startReplay(recordingId, channel, streamId, replayParams);\n}","handlingStrategy":"try-catch","validationCode":"// ensure archive session still valid\nif (archive == null || archive.isClosed()) archive = AeronArchive.connect(ctx);","typeGuard":null,"tryCatchPattern":"try { archive.startReplay(recordingId, ch, sid, params); } catch (ArchiveException e) { reconnectArchive(); }","preventionTips":["Keep the archive session alive (keep-alive is sent by the client library)","Reconnect on any ArchiveException during command offers","Validate channel configuration against archive server settings"],"tags":["aeron-archive","replay","publication-offer"],"backgroundTag":"api-request-failed","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"}