{"record":{"id":"9089553bab5e919f","repo":"aeron-io/aeron","slug":"failed-to-send-find-last-matching-recording-request","errorCode":null,"errorMessage":"failed to send find last matching recording request","messagePattern":"failed to send find last matching recording request","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java","lineNumber":1658,"sourceCode":"     * @param streamId        of the recording to match.\n     * @param sessionId       of the recording to match.\n     * @return the recordingId if found otherwise {@link Aeron#NULL_VALUE} if not found.\n     */\n    public long findLastMatchingRecording(\n        final long minRecordingId, final String channelFragment, final int streamId, final int sessionId)\n    {\n        lock.lock();\n        try\n        {\n            ensureConnected();\n            ensureNotReentrant();\n\n            lastCorrelationId = aeron.nextCorrelationId();\n\n            if (!archiveProxy.findLastMatchingRecording(\n                minRecordingId, channelFragment, streamId, sessionId, lastCorrelationId, controlSessionId))\n            {\n                throw new ArchiveException(\"failed to send find last matching recording request\");\n            }\n\n            return pollForResponse(lastCorrelationId);\n        }\n        finally\n        {\n            lock.unlock();\n        }\n    }\n\n    /**\n     * Truncate a stopped recording to a given position that is less than the stopped position. The provided position\n     * must be on a fragment boundary. Truncating a recording to the start position effectively deletes the recording.\n     * <p>\n     * Truncating a recording will stop any concurrent replays of that recording.\n     *\n     * @param recordingId of the stopped recording to be truncated.\n     * @param position    to which the recording will be truncated.","sourceCodeStart":1640,"sourceCodeEnd":1676,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java#L1640-L1676","documentation":"AeronArchive.findLastMatchingRecording() throws this ArchiveException when the findLastMatchingRecording request could not be sent to the archive control-request publication. archiveProxy.findLastMatchingRecording() returned false, meaning the offer was rejected because the publication is not connected, has been closed, or was back-pressured throughout the retry window, so pollForResponse never executes.","triggerScenarios":"Calling findLastMatchingRecording(minRecordingId, channelFragment, streamId, sessionId) while the archive control publication cannot accept the message: archive down/restarting, control session closed or expired, control-request buffer full of queued commands, or wrong control channel configuration.","commonSituations":"Locating the latest recording for a channel during archive failover; clients whose control session the archive has timed out; repeated search queries piling onto a saturated control stream.","solutions":["Verify the archive is running and the control-channel endpoint/aeron.dir settings match on both sides.","Retry findLastMatchingRecording with backoff; transient back-pressure is the usual cause.","Recreate the archive session with AeronArchive.connect() if the control session was closed server-side.","Rate-limit recording searches so the control publication buffer does not fill.","Check archive logs for the session-close or publication error that caused the rejected offer."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!archive.archiveProxy().controlPublication().isConnected()) {\n    throw new IllegalStateException(\"archive control publication not connected\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    long id = archive.findLastMatchingRecording(minRecordingId, channelFragment, streamId, sessionId);\n} catch (ArchiveException e) {\n    if (e.getMessage().contains(\"failed to send find last matching recording request\")) {\n        Thread.sleep(backoffMs); // retry or reconnect\n    } else { throw e; }\n}","preventionTips":["Confirm the archive is healthy before running recording searches.","Throttle search queries so the control publication stays unsaturated.","Use retry-with-backoff wrappers around all archive lookups.","Detect and recover from control-session closure proactively."],"tags":["aeron-archive","backpressure","control-channel","search"],"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-15T23:17:13.987Z"}