{"record":{"id":"276a09507e38ffe1","repo":"aeron-io/aeron","slug":"uri-length-length-exceeds-max-supported-length-max-uri","errorCode":null,"errorMessage":"URI length (<length>) exceeds max supported length (<MAX_URI_LENGTH>): <uri-prefix>","messagePattern":"URI length \\(<length>\\) exceeds max supported length \\(<MAX_URI_LENGTH>\\): <uri-prefix>","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/ChannelUri.java","lineNumber":378,"sourceCode":"        put(INITIAL_TERM_ID_PARAM_NAME, Integer.toString(initialTermId));\n        put(TERM_ID_PARAM_NAME, Integer.toString(termId));\n        put(TERM_OFFSET_PARAM_NAME, Integer.toString(termOffset));\n        put(TERM_LENGTH_PARAM_NAME, Integer.toString(termLength));\n    }\n\n    /**\n     * Parse a {@link CharSequence} which contains an Aeron URI.\n     *\n     * @param uri to be parsed.\n     * @return a new {@link ChannelUri} representing the URI string.\n     */\n    @SuppressWarnings(\"MethodLength\")\n    public static ChannelUri parse(final CharSequence uri)\n    {\n        final int length = uri.length();\n        if (length > MAX_URI_LENGTH)\n        {\n            throw new IllegalArgumentException(\"URI length (\" + length + \") exceeds max supported length (\" +\n                MAX_URI_LENGTH + \"): \" + uri.subSequence(0, MAX_URI_LENGTH));\n        }\n\n        int position = 0;\n        final String prefix;\n        if (startsWith(uri, 0, SPY_PREFIX))\n        {\n            prefix = SPY_QUALIFIER;\n            position = SPY_PREFIX.length();\n        }\n        else\n        {\n            prefix = \"\";\n        }\n\n        if (!startsWith(uri, position, AERON_PREFIX))\n        {\n            throw new IllegalArgumentException(\"Aeron URIs must start with 'aeron:', found: \" + uri);","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/ChannelUri.java#L360-L396","documentation":"ChannelUri.parse rejects any Aeron URI longer than MAX_URI_LENGTH, throwing IllegalArgumentException that includes the length, the max, and a prefix of the offending URI. URIs are stored in fixed-size structures (e.g. sent in subscription/publication setup and stored in the driver), so a hard cap is enforced.","triggerScenarios":"Calling ChannelUri.parse(uri) where uri.length() > MAX_URI_LENGTH — e.g. a channel string with very long endpoint names, embedded credentials, or concatenated control/properties.","commonSituations":"Programmatically building URIs with many parameters and never length-checking; hostnames/IPs plus options pushing past the limit; a corrupted or malicious channel string from external input.","solutions":["Check uri.length() against ChannelUri.MAX_URI_LENGTH before parsing and trim/simplify the channel config.","Shorten the URI: remove unneeded parameters, use shorter endpoint names, or move options to configuration instead of the URI.","If the URI comes from external input, validate the length at ingestion with a clear error message."],"exampleFix":"// before\nChannelUri uri = ChannelUri.parse(userSuppliedUri);\n// after\nif (userSuppliedUri.length() > ChannelUri.MAX_URI_LENGTH) {\n    throw new ConfigException(\"channel URI too long (max \" + ChannelUri.MAX_URI_LENGTH + \")\");\n}\nChannelUri uri = ChannelUri.parse(userSuppliedUri);","handlingStrategy":"validation","validationCode":"if (channelUri == null || channelUri.length() > ChannelUri.MAX_URI_LENGTH) {\n    throw new ConfigException(\"channel URI missing or longer than \" + ChannelUri.MAX_URI_LENGTH);\n}","typeGuard":null,"tryCatchPattern":"try {\n    ChannelUri uri = ChannelUri.parse(channel);\n} catch (IllegalArgumentException e) {\n    log.error(\"bad channel URI: \" + e.getMessage());\n}","preventionTips":["Validate URI length at config ingestion, before the driver sees it","Keep channel URIs minimal — move bulky options to driver config","Trim hostnames/parameters if nearing the limit"],"tags":["aeron","channel-uri","uri","validation"],"backgroundTag":"invalid-url-format","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"}