{"record":{"id":"8ace83c2c4dc702e","repo":"aeron-io/aeron","slug":"unknown-address-type-addresstype","errorCode":null,"errorMessage":"Unknown address type:{addressType}","messagePattern":"Unknown address type:(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/command/PublicationErrorFrameFlyweight.java","lineNumber":302,"sourceCode":"     * @return source address of the error frame.\n     */\n    public InetSocketAddress sourceAddress()\n    {\n        final short addressType = buffer.getShort(offset + ADDRESS_TYPE_OFFSET);\n        final int port = buffer.getShort(offset + ADDRESS_PORT_OFFSET) & 0xFFFF;\n\n        final byte[] address;\n        if (ADDRESS_TYPE_IPV4 == addressType)\n        {\n            address = new byte[IPV4_ADDRESS_LENGTH];\n        }\n        else if (ADDRESS_TYPE_IPV6 == addressType)\n        {\n            address = new byte[IPV6_ADDRESS_LENGTH];\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"Unknown address type:\" + addressType);\n        }\n\n        buffer.getBytes(offset + ADDRESS_OFFSET, address);\n        try\n        {\n            return new InetSocketAddress(Inet4Address.getByAddress(address), port);\n        }\n        catch (final UnknownHostException ex)\n        {\n            throw new IllegalArgumentException(\"Unknown address type:\" + addressType, ex);\n        }\n\n    }\n\n    /**\n     * Error code for the command.\n     *\n     * @return error code for the command.","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/command/PublicationErrorFrameFlyweight.java#L284-L320","documentation":"When decoding a publication error frame, sourceAddress() reads the ADDRESS_TYPE short field; only ADDRESS_TYPE_IPV4 (0) and ADDRESS_TYPE_IPV6 (1) are defined. Any other addressType value is rejected with IllegalArgumentException because the address length and decoding method are unknown.","triggerScenarios":"Reading an error frame whose ADDRESS_TYPE_OFFSET field contains an undefined type — a corrupted buffer, a writer from a future Aeron version emitting a new address type, or an encoder writing the type field at the wrong offset.","commonSituations":"Version skew between sender and receiver of error frames; memory corruption or misaligned flyweight offset; custom protocol extensions not understood by this version.","solutions":["Verify sender and receiver use the same Aeron version supporting the same address-type constants.","Check the flyweight offset passed to sourceAddress() matches the frame layout (offset misalignment shifts the type field).","Validate the addressType value before calling, treating unknown types as corrupt frames and dropping them.","Re-encode the frame ensuring putShort(ADDRESS_TYPE_OFFSET, ADDRESS_TYPE_IPV4|IPV6) is used."],"exampleFix":"// before\nshort type = buffer.getShort(offset + TYPE_OFF);\nflyweight.sourceAddress(type); // throws for unknown values\n// after\nshort type = buffer.getShort(offset + PublicationErrorFrameFlyweight.ADDRESS_TYPE_OFFSET);\nif (type == PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV4 ||\n    type == PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV6) {\n    flyweight.sourceAddress(type);\n}","handlingStrategy":"validation","validationCode":"short type = buffer.getShort(offset + PublicationErrorFrameFlyweight.ADDRESS_TYPE_OFFSET);\nif (type != PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV4 && type != PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV6) {\n    throw new IllegalArgumentException(\"unsupported address type in frame: \" + type);\n}","typeGuard":"static boolean isKnownAddressType(short t) {\n    return t == PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV4 || t == PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV6;\n}","tryCatchPattern":"try { InetSocketAddress src = flyweight.sourceAddress(addressType); } catch (IllegalArgumentException e) { log.warn(\"Corrupt error frame, dropping\", e); }","preventionTips":["Use the ADDRESS_TYPE_* constants when encoding, never raw shorts","Ensure flyweight offset matches the frame layout","Keep sender and receiver Aeron versions in sync","Validate frames against expected size before decoding"],"tags":["aeron","network","ip-address","illegal-argument"],"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-19T12:17:13.211Z"}