{"record":{"id":"0a04765243e53535","repo":"aeron-io/aeron","slug":"unknown-address-type-simplename","errorCode":null,"errorMessage":"Unknown address type:{simpleName}","messagePattern":"Unknown address type:(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/command/PublicationErrorFrameFlyweight.java","lineNumber":275,"sourceCode":"    {\n        final short sourcePort = (short)(sourceAddress.getPort() & 0xFFFF);\n        final InetAddress address = sourceAddress.getAddress();\n\n        buffer.putShort(offset + ADDRESS_PORT_OFFSET, sourcePort);\n        buffer.putBytes(offset + ADDRESS_OFFSET, address.getAddress());\n        if (address instanceof Inet4Address)\n        {\n            buffer.putShort(offset + ADDRESS_TYPE_OFFSET, ADDRESS_TYPE_IPV4);\n            buffer.setMemory(\n                offset + ADDRESS_OFFSET + IPV4_ADDRESS_LENGTH, IPV6_ADDRESS_LENGTH - IPV4_ADDRESS_LENGTH, (byte)0);\n        }\n        else if (address instanceof Inet6Address)\n        {\n            buffer.putShort(offset + ADDRESS_TYPE_OFFSET, ADDRESS_TYPE_IPV6);\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"Unknown address type:\" + address.getClass().getSimpleName());\n        }\n\n        return this;\n    }\n\n    /**\n     * Get the source address of this error frame.\n     *\n     * @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        {","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/command/PublicationErrorFrameFlyweight.java#L257-L293","documentation":"PublicationErrorFrameFlyweight.sourceAddress(InetSocketAddress) only knows how to encode Inet4Address and Inet6Address instances into the error frame. If the passed socket address wraps any other InetAddress subclass (or null-like variant), it throws IllegalArgumentException.","triggerScenarios":"Calling sourceAddress() with an InetSocketAddress whose address is not Inet4Address or Inet6Address — typically from a socket bound to a custom InetAddress subclass, a loopback/any-address produced unusually, or programmatic construction of an address object that isn't a standard IP address.","commonSituations":"Using a proxy/socket library that returns custom InetAddress subclasses; building InetSocketAddress from an unresolved hostname (address is null/InetSocketAddress is unresolved); tests that fabricate InetAddress subclasses.","solutions":["Resolve the hostname before calling sourceAddress: ensure address.getAddress() is non-null and is Inet4Address or Inet6Address.","Use InetAddress.getByName(host) or InetSocketAddress with a resolvable host so a standard IPv4/IPv6 address is produced.","Normalize loopback/any addresses via InetAddress.getLoopbackAddress() or InetAddress.getByAddress(new byte[4]) before encoding.","Reject or skip error frames whose source address cannot be resolved to a plain IP."],"exampleFix":"// before\nflyweight.sourceAddress(new InetSocketAddress(host, port)); // unresolved -> non-IP\n// after\nInetAddress addr = InetAddress.getByName(host); // resolves to Inet4/6\nflyweight.sourceAddress(new InetSocketAddress(addr, port));","handlingStrategy":"validation","validationCode":"InetAddress addr = socketAddress.getAddress();\nif (!(addr instanceof Inet4Address) && !(addr instanceof Inet6Address)) {\n    throw new IllegalArgumentException(\"address must be resolved IPv4/IPv6: \" + socketAddress);\n}","typeGuard":"static boolean isEncodableAddress(InetSocketAddress a) {\n    return a != null && !a.isUnresolved()\n        && (a.getAddress() instanceof Inet4Address || a.getAddress() instanceof Inet6Address);\n}","tryCatchPattern":"try { flyweight.sourceAddress(socketAddress); } catch (IllegalArgumentException e) { log.warn(\"Skipping error frame with non-IP source address\", e); }","preventionTips":["Resolve hostnames with InetAddress.getByName before constructing the InetSocketAddress","Check InetSocketAddress.isUnresolved() before encoding","Avoid InetAddress subclasses from proxy/socket libraries","Prefer passing raw byte arrays via getByAddress for synthetic addresses"],"tags":["aeron","network","ip-address","illegal-argument"],"backgroundTag":"invalid-argument-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"}