aeron-io/aeron · error · IllegalArgumentException

unable to find response subscription for…

Error message

unable to find response subscription for response-correlation-id=${responseCorrelationId}

What it means

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.

Solutions

  1. Create the response subscription first and use its registrationId (from the RegistrationAck) as responseCorrelationId
  2. Verify the subscription is still open and registered with the same driver instance before adding the publication
  3. Catch IllegalArgumentException from client.addPublication and re-create/re-link the subscription

Example fix

// before
long subId = client.addSubscription(...); client.closeSubscription(subId); // closed first
client.addPublication(channel + "|response-correlation-id=" + subId, streamId); // throws
// after
long subId = client.addSubscription(...); // keep subscription open
client.addPublication(channel + "|response-correlation-id=" + subId, streamId);
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the response subscription exists and is open before adding the publication
if (!openSubscriptionIds.contains(responseCorrelationId)) throw new IllegalStateException("create response subscription first");

Try / catch

try { client.addPublication(uriWithResponseCorrelationId, streamId); } catch (IllegalArgumentException e) { if (e.getMessage().contains("response subscription")) { recreateSubscription(); } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12). Data as JSON: /api/errors/9c222772c1723273. Report an issue: GitHub.

Appendix: source

Thrown at aeron-driver/src/main/java/io/aeron/driver/DriverConductor.java:547

                    publicationImage.responseSessionId(null);
                }
            }
        }
    }

    private void validateResponseSubscription(final PublicationParams params)
    {
        if (!params.isResponse && NULL_VALUE != params.responseCorrelationId)
        {
            for (final SubscriptionLink subscriptionLink : subscriptionLinks)
            {
                if (params.responseCorrelationId == subscriptionLink.registrationId())
                {
                    return;
                }
            }

            throw new IllegalArgumentException(
                "unable to find response subscription for response-correlation-id=" + params.responseCorrelationId);
        }
    }

    void cleanupSpies(final NetworkPublication publication)
    {
        for (int i = 0, size = subscriptionLinks.size(); i < size; i++)
        {
            final SubscriptionLink link = subscriptionLinks.get(i);
            if (link.isLinked(publication))
            {
                notifyUnavailableImageLink(publication.registrationId(), link);
                link.unlink(publication);
            }
        }
    }

    void notifyUnavailableImageLink(final long resourceId, final SubscriptionLink link)

View on GitHub (pinned to 6d60124e15)