{"record":{"id":"603d55af63420793","repo":"aeron-io/aeron","slug":"udpchannel-only-supports-udp-media","errorCode":null,"errorMessage":"UdpChannel only supports UDP media: ","messagePattern":"UdpChannel only supports UDP media: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java","lineNumber":1080,"sourceCode":"\n    private static void validateDataAddress(final byte[] addressAsBytes)\n    {\n        if (BitUtil.isEven(addressAsBytes[addressAsBytes.length - 1]))\n        {\n            throw new IllegalArgumentException(\"multicast data address must be odd\");\n        }\n    }\n\n    private static void validateConfiguration(final ChannelUri uri)\n    {\n        validateMedia(uri);\n    }\n\n    private static void validateMedia(final ChannelUri uri)\n    {\n        if (!uri.isUdp())\n        {\n            throw new IllegalArgumentException(\"UdpChannel only supports UDP media: \" + uri);\n        }\n    }\n\n    static final class Context\n    {\n        ControlMode controlMode = ControlMode.NONE;\n        boolean hasExplicitEndpoint = false;\n        boolean hasExplicitControl = false;\n        boolean isMulticast = false;\n        boolean hasMulticastTtl = false;\n        boolean hasTagId = false;\n        boolean hasNoDistinguishingCharacteristic = false;\n        int socketRcvbufLength = 0;\n        int socketSndbufLength = 0;\n        int receiverWindowLength = 0;\n        int multicastTtl;\n        long tagId;\n        InetSocketAddress remoteData;","sourceCodeStart":1062,"sourceCodeEnd":1098,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java#L1062-L1098","documentation":"A ChannelUri whose media/type is not 'udp' was passed to UdpChannel, which only handles UDP transport. validateMedia checks uri.isUdp() and throws IllegalArgumentException otherwise, preventing an IPC or other-transport URI from being treated as a network channel.","triggerScenarios":"Passing a URI like 'aeron:ipc' or an unknown scheme (e.g. 'aeron:tcp' if unsupported) to UdpChannel.parse, or publishing/subscribing with a channel URI missing or mistyping the media component.","commonSituations":"Configuration mixing IPC and UDP channels, a typo in the URI scheme, or generic channel-handling code that assumes all URIs are UDP and forwards them to UdpChannel.","solutions":["Ensure the channel URI starts with 'aeron:udp' for network transport.","Use the IPC path (Aeron's ipc channel handling) instead of UdpChannel for 'aeron:ipc' URIs.","Add a check that dispatches on uri.media()/scheme before calling UdpChannel.parse."],"exampleFix":"// before\nString uri = \"aeron:ipc\";\nUdpChannel.parse(uri); // throws\n// after\nString uri = \"aeron:udp?endpoint=localhost:40456\";\nif (ChannelUri.parse(uri).isUdp()) {\n    UdpChannel.parse(uri);\n}","handlingStrategy":"type-guard","validationCode":"ChannelUri uri = ChannelUri.parse(channelStr);\nif (!\"udp\".equals(uri.media())) { /* route to IPC or other transport handler */ }","typeGuard":"boolean isUdpChannel(String s) {\n    return s != null && s.startsWith(\"aeron:udp\");\n}","tryCatchPattern":"try {\n    UdpChannel.parse(uriStr);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"only supports UDP\")) { /* dispatch non-UDP transport */ }\n}","preventionTips":["Dispatch on ChannelUri.media() before transport-specific parsing","Keep a single URI-builder utility to avoid scheme typos","Validate channel URIs in config loading"],"tags":["configuration","uri","validation","udp"],"backgroundTag":"invalid-argument-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"}