{"record":{"id":"10494fda82bafa8b","repo":"aeron-io/aeron","slug":"no-subscription-for-stream-streamid","errorCode":null,"errorMessage":"no subscription for stream ${streamId}","messagePattern":"no subscription for stream (.+?)","errorType":"exception","errorClass":"UnknownSubscriptionException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/DataPacketDispatcher.java","lineNumber":185,"sourceCode":"\n        final SessionState sessionState = streamInterest.sessionInterestByIdMap.get(sessionId);\n        if (NO_INTEREST == sessionState)\n        {\n            streamInterest.sessionInterestByIdMap.remove(sessionId);\n        }\n    }\n\n    /**\n     * Remove a subscription for a previously registered given stream id and wildcard session id.\n     *\n     * @param streamId to remove the capture for.\n     */\n    public void removeSubscription(final int streamId)\n    {\n        final StreamInterest streamInterest = streamInterestByIdMap.get(streamId);\n        if (null == streamInterest)\n        {\n            throw new UnknownSubscriptionException(\"no subscription for stream \" + streamId);\n        }\n\n        streamInterest.removeNonSessionSpecificInterest();\n\n        streamInterest.isAllSessions = false;\n\n        if (streamInterest.subscribedSessionIds.isEmpty())\n        {\n            streamInterestByIdMap.remove(streamId);\n        }\n    }\n\n    /**\n     * Remove a subscription for a previously registered given stream id and session id.\n     *\n     * @param streamId  to remove the capture for.\n     * @param sessionId within the given stream id.\n     */","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/DataPacketDispatcher.java#L167-L203","documentation":"DataPacketDispatcher.removeSubscription(streamId) throws UnknownSubscriptionException when there is no registered stream-level interest for the given streamId. The driver never saw a matching wildcard subscription for that stream.","triggerScenarios":"Calling DriverConductor/client API to remove a subscription (with only streamId, i.e. all-sessions interest) when no subscription with that streamId is registered in the dispatcher.","commonSituations":"Double-close of a subscription, closing a subscription on the wrong streamId, or a race where the subscription was already removed by another path.","solutions":["Verify the streamId matches an existing subscription before removal","Track removal so each subscription is removed exactly once","Catch UnknownSubscriptionException and treat it as idempotent cleanup if double-removal is expected"],"exampleFix":"// before\ndispatcher.removeSubscription(streamId); // throws if already removed\n// after\nif (dispatcher.hasSubscription(streamId)) { dispatcher.removeSubscription(streamId); }","handlingStrategy":"try-catch","validationCode":"// track live streamIds your client registered\nif (!registeredStreamIds.contains(streamId)) return;","typeGuard":null,"tryCatchPattern":"try { dispatcher.removeSubscription(streamId); } catch (UnknownSubscriptionException e) { /* already removed; ignore */ }","preventionTips":["Remove each subscription exactly once","Keep ownership of subscription lifecycle in one component","Match streamIds against your client's registered set"],"tags":["subscription","aeron-driver","dispatcher"],"backgroundTag":"record-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"}