{"record":{"id":"049490bb99bd2583","repo":"aeron-io/aeron","slug":"stream-id-configuredstreamid-does-not-match-provided","errorCode":null,"errorMessage":"stream-id={configuredStreamId} does not match provided streamId={streamId}","messagePattern":"stream-id=(.+?) does not match provided streamId=(.+?)","errorType":"validation","errorClass":"InvalidChannelException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/PublicationParams.java","lineNumber":206,"sourceCode":"            publicationWindowLength = (int)pubWindow;\n        }\n        else\n        {\n            publicationWindowLength = Configuration.producerWindowLength(\n                termLength,\n                channelUri.isIpc() ? ctx.ipcPublicationTermWindowLength() : ctx.publicationTermWindowLength());\n        }\n    }\n\n    private void getStreamId(final ChannelUri channelUri, final int streamId)\n    {\n        final String streamIdParam = channelUri.get(STREAM_ID_PARAM_NAME);\n        if (null != streamIdParam)\n        {\n            final int configuredStreamId = parseInt(streamIdParam, STREAM_ID_PARAM_NAME);\n            if (streamId != configuredStreamId)\n            {\n                throw new InvalidChannelException(\n                    STREAM_ID_PARAM_NAME + \"=\" + configuredStreamId + \" does not match provided streamId=\" + streamId);\n            }\n        }\n        this.streamId = streamId;\n    }\n\n    private void getEntityTag(final ChannelUri channelUri, final DriverConductor driverConductor)\n    {\n        final String tagParam = channelUri.entityTag();\n        if (null != tagParam)\n        {\n            this.entityTag = parseEntityTag(tagParam, driverConductor, channelUri);\n        }\n    }\n\n    private void getTermBufferLength(final ChannelUri channelUri)\n    {\n        final String termLengthParam = channelUri.get(TERM_LENGTH_PARAM_NAME);","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/PublicationParams.java#L188-L224","documentation":"If a stream-id URI parameter is present it must match the streamId passed to the API call (e.g. Aeron.addPublication(channel, streamId)). A mismatch means the URI and the programmatic argument disagree, so Aeron throws InvalidChannelException instead of guessing which one is intended.","triggerScenarios":"Calling addPublication/addExclusivePublication with a streamId different from the stream-id= param embedded in the channel URI string.","commonSituations":"Building URIs from config that already include stream-id while passing a separate (stale) streamId variable; changing stream IDs in one place (config) but not the other (code); template URIs with a hardcoded stream-id reused across topics.","solutions":["Make the streamId argument match the stream-id URI param (or vice versa)","Strip the stream-id param from the channel URI and pass streamId only programmatically","Parse the URI with ChannelUri and use its stream-id value as the single source of truth"],"exampleFix":"// before\naeron.addPublication(\"aeron:udp?endpoint=...:40456|stream-id=1001\", 1002);\n// after\naeron.addPublication(\"aeron:udp?endpoint=...:40456\", 1001);","handlingStrategy":"validation","validationCode":"ChannelUri c = ChannelUri.parse(uri); String p = c.get(\"stream-id\"); if (p != null && Integer.parseInt(p) != streamId) throw new IllegalArgumentException(\"stream-id mismatch\");","typeGuard":null,"tryCatchPattern":"try { pub = aeron.addPublication(uri, streamId); } catch (InvalidChannelException e) { log.error(\"stream-id mismatch: {}\", e.getMessage()); }","preventionTips":["Use a single source of truth for stream IDs (URI or API arg, not both)","Strip stream-id from template URIs","Verify URIs against the streamId variable in integration tests"],"tags":["aeron","uri","validation"],"backgroundTag":"conflicting-config-options","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"}