{"record":{"id":"9c222772c1723273","repo":"aeron-io/aeron","slug":"unable-to-find-response-subscription-for-response","errorCode":null,"errorMessage":"unable to find response subscription for response-correlation-id=${responseCorrelationId}","messagePattern":"unable to find response subscription for response-correlation-id=(.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/DriverConductor.java","lineNumber":547,"sourceCode":"                    publicationImage.responseSessionId(null);\n                }\n            }\n        }\n    }\n\n    private void validateResponseSubscription(final PublicationParams params)\n    {\n        if (!params.isResponse && NULL_VALUE != params.responseCorrelationId)\n        {\n            for (final SubscriptionLink subscriptionLink : subscriptionLinks)\n            {\n                if (params.responseCorrelationId == subscriptionLink.registrationId())\n                {\n                    return;\n                }\n            }\n\n            throw new IllegalArgumentException(\n                \"unable to find response subscription for response-correlation-id=\" + params.responseCorrelationId);\n        }\n    }\n\n    void cleanupSpies(final NetworkPublication publication)\n    {\n        for (int i = 0, size = subscriptionLinks.size(); i < size; i++)\n        {\n            final SubscriptionLink link = subscriptionLinks.get(i);\n            if (link.isLinked(publication))\n            {\n                notifyUnavailableImageLink(publication.registrationId(), link);\n                link.unlink(publication);\n            }\n        }\n    }\n\n    void notifyUnavailableImageLink(final long resourceId, final SubscriptionLink link)","sourceCodeStart":529,"sourceCodeEnd":565,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/DriverConductor.java#L529-L565","documentation":"DriverConductor.validateResponseSubscription throws IllegalArgumentException when a publication/channel request specifies a responseCorrelationId but no existing subscription link matches that registration id. The driver requires the response subscription to be established first for request-response channels.","triggerScenarios":"Publishing on a request-response channel where the response subscription's registrationId is not found among the subscription links, e.g. the response subscription was never created, already closed, or a wrong correlation id was passed.","commonSituations":"Adding a publication with responseCorrelationId pointing to a subscription created in a different Aeron client/driver, closing the response subscription before the publication is added, or reusing a stale correlation id after a driver restart.","solutions":["Create the response subscription first and use its registrationId (from the RegistrationAck) as responseCorrelationId","Verify the subscription is still open and registered with the same driver instance before adding the publication","Catch IllegalArgumentException from client.addPublication and re-create/re-link the subscription"],"exampleFix":"// before\nlong subId = client.addSubscription(...); client.closeSubscription(subId); // closed first\nclient.addPublication(channel + \"|response-correlation-id=\" + subId, streamId); // throws\n// after\nlong subId = client.addSubscription(...); // keep subscription open\nclient.addPublication(channel + \"|response-correlation-id=\" + subId, streamId);","handlingStrategy":"try-catch","validationCode":"// ensure the response subscription exists and is open before adding the publication\nif (!openSubscriptionIds.contains(responseCorrelationId)) throw new IllegalStateException(\"create response subscription first\");","typeGuard":null,"tryCatchPattern":"try { client.addPublication(uriWithResponseCorrelationId, streamId); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"response subscription\")) { recreateSubscription(); } else throw e; }","preventionTips":["Always create the response subscription before the request-response publication","Use the registrationId from the client ack, not a guessed id","Keep subscription and publication lifecycle in the same client/driver session"],"tags":["subscription","request-response","correlation-id","aeron-driver"],"backgroundTag":"resource-not-found","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"}