{"record":{"id":"88c67a58bb2b35f5","repo":"aeron-io/aeron","slug":"destinations-must-not-contain-the-key-invalidkey-channel","errorCode":null,"errorMessage":"destinations must not contain the key: {invalidKey} channel={destinationUri}","messagePattern":"destinations must not contain the key: (.+?) channel=(.+?)","errorType":"validation","errorClass":"InvalidChannelException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/DriverConductor.java","lineNumber":2383,"sourceCode":"            throw new InvalidChannelException(\n                \"Media timestamps '\" + MEDIA_RCV_TIMESTAMP_OFFSET_PARAM_NAME +\n                    \"' are not supported in the Java driver: channel=\" + udpChannel.originalUriString());\n        }\n    }\n\n    private static void validateDestinationUri(final ChannelUri uri, final String destinationUri)\n    {\n        if (SPY_QUALIFIER.equals(uri.prefix()))\n        {\n            throw new InvalidChannelException(\"Aeron spies are invalid as send destinations: channel=\" +\n                destinationUri);\n        }\n\n        for (final String invalidKey : INVALID_DESTINATION_KEYS)\n        {\n            if (uri.containsKey(invalidKey))\n            {\n                throw new InvalidChannelException(\n                    \"destinations must not contain the key: \" + invalidKey + \" channel=\" + destinationUri);\n            }\n        }\n\n        if (Objects.equals(CONTROL_MODE_RESPONSE, uri.get(MDC_CONTROL_MODE_PARAM_NAME)))\n        {\n            throw new InvalidChannelException(\"destinations may not specify \" +\n                MDC_CONTROL_MODE_PARAM_NAME + \"=\" + CONTROL_MODE_RESPONSE);\n        }\n    }\n\n    private static void validateSendDestinationUri(final ChannelUri uri, final String destinationUri)\n    {\n        final String endpoint = uri.get(ENDPOINT_PARAM_NAME);\n\n        if (null != endpoint && endpoint.endsWith(\":0\"))\n        {\n            throw new InvalidChannelException(ENDPOINT_PARAM_NAME + \" has port=0 for send destination: channel=\" +","sourceCodeStart":2365,"sourceCodeEnd":2401,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/DriverConductor.java#L2365-L2401","documentation":"When validating destination URIs (for MDC manual destinations, multi-destination publications, or terminals), the driver rejects URIs containing keys that are meaningless or illegal in a destination context (INVALID_DESTINATION_KEYS, e.g. control-related params reserved for the owning channel). The offending key name is included in the message.","triggerScenarios":"Calling Publication.addDestination()/removeDestination() or addRcvDestination() with a URI containing a forbidden key (e.g. control-mode, session-id, or other keys in INVALID_DESTINATION_KEYS).","commonSituations":"Reusing a full channel URI as a destination string including control params; template-generated URIs carrying extra parameters; copy-paste of subscription channel into destination list.","solutions":["Strip the offending key from the destination URI before adding it.","Build destinations from minimal URIs (endpoint or control only, e.g. \"aeron:udp?endpoint=host:port\").","Validate destination URIs with ChannelUri.parse and reject disallowed keys before calling the API."],"exampleFix":"// before\npublication.addDestination(\"aeron:udp?endpoint=h:40456|control-mode=manual\");\n// after\npublication.addDestination(\"aeron:udp?endpoint=h:40456\");","handlingStrategy":"validation","validationCode":"ChannelUri uri = ChannelUri.parse(destination);\nfor (String bad : new String[]{\"control-mode\", \"session-id\"})\n  if (uri.containsKey(bad)) throw new IllegalArgumentException(\"destination must not contain key: \" + bad);","typeGuard":"boolean isCleanDestination(ChannelUri uri) {\n  return !uri.containsKey(\"control-mode\"); // plus any other INVALID_DESTINATION_KEYS\n}","tryCatchPattern":"try { publication.addDestination(destination); }\ncatch (InvalidChannelException e) { if (e.getMessage().startsWith(\"destinations must not contain the key\")) { /* rebuild minimal URI */ } else throw e; }","preventionTips":["Build destination URIs with only endpoint/control params","Never pass a full channel URI string as a destination","Parse and sanitize URIs through one shared helper"],"tags":["aeron","destination-uri","channel-uri","validation"],"backgroundTag":"invalid-config-value","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"}