{"record":{"id":"e9e3fc86181420cf","repo":"aeron-io/aeron","slug":"invalid-media-media","errorCode":null,"errorMessage":"invalid media: ${media}","messagePattern":"invalid media: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java","lineNumber":304,"sourceCode":"        return prefix;\n    }\n\n    /**\n     * Set the media for this channel. Valid values are \"udp\" and \"ipc\".\n     *\n     * @param media for this channel.\n     * @return this for a fluent API.\n     */\n    public ChannelUriStringBuilder media(final String media)\n    {\n        switch (media)\n        {\n            case CommonContext.UDP_MEDIA:\n            case CommonContext.IPC_MEDIA:\n                break;\n\n            default:\n                throw new IllegalArgumentException(\"invalid media: \" + media);\n        }\n\n        this.media = media;\n        return this;\n    }\n\n    /**\n     * Set the endpoint value to be what is in the {@link ChannelUri}.\n     *\n     * @param channelUri to read the value from.\n     * @return this for a fluent API.\n     */\n    public ChannelUriStringBuilder media(final ChannelUri channelUri)\n    {\n        return media(channelUri.media());\n    }\n\n    /**","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java#L286-L322","documentation":"Thrown by ChannelUriStringBuilder.media(String) when the media is not one of the supported transports: \"udp\", \"ipc\" (and the network's alias \"network\" if accepted upstream). The builder only emits URIs the driver can resolve to a transport.","triggerScenarios":"builder.media(\"tcp\"), builder.media(\"UDP\") with unexpected case handling, or passing a free-form string from configuration.","commonSituations":"Using transports Aeron doesn't support here (e.g. \"tcp\"); case mismatch; copy-pasting media values from other messaging systems (e.g. \"rdma\").","solutions":["Use CommonContext.UDP_MEDIA (\"udp\") for network transport.","Use CommonContext.IPC_MEDIA (\"ipc\") for shared-memory transport.","Trim/lowercase and validate config-provided media strings before calling media()."],"exampleFix":"// before\nbuilder.media(\"tcp\");\n// after\nbuilder.media(CommonContext.UDP_MEDIA);","handlingStrategy":"validation","validationCode":"Set<String> OK = Set.of(CommonContext.UDP_MEDIA, CommonContext.IPC_MEDIA);\nif (media != null && !OK.contains(media)) { throw new IllegalArgumentException(\"invalid media: \" + media); }","typeGuard":"boolean isValidMedia(String media) { return media == null || CommonContext.UDP_MEDIA.equals(media) || CommonContext.IPC_MEDIA.equals(media); }","tryCatchPattern":"try { builder.media(m); } catch (IllegalArgumentException e) { builder.media(CommonContext.UDP_MEDIA); }","preventionTips":["Always use the CommonContext constants instead of string literals","Lowercase/trim config-provided media values","Restrict config schemas to an enum of udp|ipc"],"tags":["aeron","channel-uri","validation","transport"],"backgroundTag":"invalid-enum-value","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}