{"record":{"id":"40f438084fc82dbb","repo":"aeron-io/aeron","slug":"mtu-length-param-name-value-integer-max-value","errorCode":null,"errorMessage":"${MTU_LENGTH_PARAM_NAME} ${value} > ${Integer.MAX_VALUE}","messagePattern":"\\$\\{MTU_LENGTH_PARAM_NAME\\} \\$\\{value\\} > \\$\\{Integer\\.MAX_VALUE\\}","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java","lineNumber":643,"sourceCode":"     *\n     * @param channelUri to read the value from.\n     * @return this for a fluent API.\n     * @see CommonContext#MTU_LENGTH_PARAM_NAME\n     */\n    public ChannelUriStringBuilder mtu(final ChannelUri channelUri)\n    {\n        final String mtuValue = channelUri.get(MTU_LENGTH_PARAM_NAME);\n        if (null == mtuValue)\n        {\n            mtu = null;\n            return this;\n        }\n        else\n        {\n            final long value = parseSize(MTU_LENGTH_PARAM_NAME, mtuValue);\n            if (value > Integer.MAX_VALUE)\n            {\n                throw new IllegalArgumentException(MTU_LENGTH_PARAM_NAME + \" \" + value + \" > \" + Integer.MAX_VALUE);\n            }\n\n            return mtu((int)value);\n        }\n    }\n\n    /**\n     * Get the maximum transmission unit (MTU) including Aeron header for a datagram payload. If this is greater\n     * than the network MTU for UDP then the packet will be fragmented and can amplify the impact of loss.\n     *\n     * @return the maximum transmission unit (MTU) including Aeron header for a datagram payload.\n     * @see CommonContext#MTU_LENGTH_PARAM_NAME\n     */\n    public Integer mtu()\n    {\n        return mtu;\n    }\n","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java#L625-L661","documentation":"Thrown by the builder's mtu(String) parse path when the parsed 'mtu' URI parameter value exceeds Integer.MAX_VALUE. The parameter is parsed as a size (long); anything beyond int range cannot be stored in the builder's Integer mtu field and is rejected before the range checks in mtu(Integer).","triggerScenarios":"A channel URI containing mtu=17179869184 (or any value > 2147483647) passed through builder.mtu(uriParameterValue) — parseSize succeeds as a long but the int cast is refused.","commonSituations":"Unit-suffixed sizes misparsed (e.g. \"16g\" intending gibibits landing as huge byte counts); typos adding digits; generating URIs programmatically with a long-typed size that was never bounded.","solutions":["Correct the URI so mtu is within 32-65504, e.g. mtu=16384.","Bound-check the long value against Integer.MAX_VALUE (and realistically 65504) before constructing the URI.","If sizes come from config with unit suffixes, verify the unit conversion; pass an aligned int to mtu(Integer) directly instead."],"exampleFix":"// before\nString mtu = \"17179869184\";\nbuilder.mtu(mtu);\n// after\nlong v = parseSize(\"mtu\", mtu);\nif (v >= 32 && v <= 65504) builder.mtu((int) v);","handlingStrategy":"validation","validationCode":"long v = parseSize(\"mtu\", rawMtu);\nif (v > Integer.MAX_VALUE) { throw new IllegalArgumentException(\"mtu too large\"); }\nbuilder.mtu((int) v);","typeGuard":"boolean isIntSized(long v) { return v >= 0 && v <= Integer.MAX_VALUE; }","tryCatchPattern":"try { builder.mtu(rawMtu); } catch (IllegalArgumentException e) { builder.mtu(16384); }","preventionTips":["Bound-check long-typed sizes before casting to int","Audit unit-suffix parsing (k/m/g) in config loading","Generate URIs with clamped, aligned int MTUs"],"tags":["aeron","channel-uri","mtu","parsing"],"backgroundTag":"value-out-of-range","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"}