{"record":{"id":"3dbefd24e1ce4b25","repo":"aeron-io/aeron","slug":"bindaddressandport-value-too-long","errorCode":null,"errorMessage":"bindAddressAndPort value too long: ","messagePattern":"bindAddressAndPort value too long: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/status/LocalSocketAddressStatus.java","lineNumber":114,"sourceCode":"\n        countersManager.setCounterRegistrationId(counter.id(), registrationId);\n\n        return counter;\n    }\n\n    /**\n     * Update the key metadata and label to contain the bound socket address once the transport is active.\n     *\n     * @param counter                representing the local socket address of the transport.\n     * @param bindAddressAndPort     in string representation.\n     * @param countersMetadataBuffer to be updated for the bound address.\n     */\n    public static void updateBindAddress(\n        final AtomicCounter counter, final String bindAddressAndPort, final UnsafeBuffer countersMetadataBuffer)\n    {\n        if (bindAddressAndPort.length() > MAX_IPV6_LENGTH)\n        {\n            throw new IllegalArgumentException(\n                \"bindAddressAndPort value too long: \" + bindAddressAndPort.length() + \" max: \" + MAX_IPV6_LENGTH);\n        }\n\n        final int keyIndex = CountersReader.metaDataOffset(counter.id()) + CountersReader.KEY_OFFSET;\n        final int addressStringIndex = keyIndex + LOCAL_SOCKET_ADDRESS_STRING_OFFSET;\n        final int length = countersMetadataBuffer.putStringWithoutLengthAscii(addressStringIndex, bindAddressAndPort);\n        final int addressLengthIndex = keyIndex + LOCAL_SOCKET_ADDRESS_LENGTH_OFFSET;\n        countersMetadataBuffer.putInt(addressLengthIndex, length);\n\n        counter.appendToLabel(bindAddressAndPort);\n    }\n\n    /**\n     * Find the list of currently bound local sockets.\n     *\n     * @param countersReader  for the connected driver.\n     * @param channelStatus   value for the channel which aggregates the transports.\n     * @param channelStatusId identity of the counter for the channel which aggregates the transports.","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/status/LocalSocketAddressStatus.java#L96-L132","documentation":"LocalSocketAddressStatus.updateBindAddress throws IllegalArgumentException when the bindAddressAndPort string exceeds MAX_IPV6_LENGTH, because the value is written into a fixed-size region of the counter's key/metadata buffer and cannot fit. This is a hard capacity limit of the counter key layout, not a network error.","triggerScenarios":"Calling updateBindAddress with a string whose length() > MAX_IPV6_LENGTH, e.g. an IPv6 address with scope identifier plus port producing a very long literal.","commonSituations":"IPv6 literals with long interface scope IDs (e.g. 'fe80::1%enp0s31f6:port') formatted into bind address strings; custom channel configurations emitting unusually long bind addresses.","solutions":["Shorten the bind address representation before calling (drop scope id, or use canonical IPv6 form)","Verify MAX_IPV6_LENGTH and ensure your formatter never exceeds it","Catch IllegalArgumentException and log instead of writing when the address string is abnormally long"],"exampleFix":"// before\nLocalSocketAddressStatus.updateBindAddress(counter, bindAddressAndPort, metadataBuffer);\n// after\nif (bindAddressAndPort.length() <= MAX_IPV6_LENGTH)\n{\n    LocalSocketAddressStatus.updateBindAddress(counter, bindAddressAndPort, metadataBuffer);\n}","handlingStrategy":"validation","validationCode":"if (bindAddressAndPort != null && bindAddressAndPort.length() > MAX_IPV6_LENGTH) { /* truncate/canonicalize before update */ }","typeGuard":"null","tryCatchPattern":"try { LocalSocketAddressStatus.updateBindAddress(counter, addr, buf); }\ncatch (IllegalArgumentException e) { log.warn(\"bind address too long\", e); }","preventionTips":["Canonicalize IPv6 literals and strip scope IDs when possible","Assert bind-address string length in channel configuration tests"],"tags":["aeron","counters","ipv6","argument-validation"],"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-19T12:17:13.211Z"}