aeron-io/aeron · error · IllegalArgumentException
Unknown address type
Error message
Unknown address type:{simpleName} What it means
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.
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.
Example fix
// before flyweight.sourceAddress(new InetSocketAddress(host, port)); // unresolved -> non-IP // after InetAddress addr = InetAddress.getByName(host); // resolves to Inet4/6 flyweight.sourceAddress(new InetSocketAddress(addr, port));
Defensive patterns
Strategy: validation
Validate before calling
InetAddress addr = socketAddress.getAddress();
if (!(addr instanceof Inet4Address) && !(addr instanceof Inet6Address)) {
throw new IllegalArgumentException("address must be resolved IPv4/IPv6: " + socketAddress);
} Type guard
static boolean isEncodableAddress(InetSocketAddress a) {
return a != null && !a.isUnresolved()
&& (a.getAddress() instanceof Inet4Address || a.getAddress() instanceof Inet6Address);
} Try / catch
try { flyweight.sourceAddress(socketAddress); } catch (IllegalArgumentException e) { log.warn("Skipping error frame with non-IP source address", e); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Unknown address type
- could not re-resolve: control=
- could not re-resolve: endpoint=
- could not resolve control address:
- could not resolve endpoint address:
AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12).
Data as JSON: /api/errors/0a04765243e53535.
Report an issue: GitHub.
Appendix: source
Thrown at aeron-client/src/main/java/io/aeron/command/PublicationErrorFrameFlyweight.java:275
{
final short sourcePort = (short)(sourceAddress.getPort() & 0xFFFF);
final InetAddress address = sourceAddress.getAddress();
buffer.putShort(offset + ADDRESS_PORT_OFFSET, sourcePort);
buffer.putBytes(offset + ADDRESS_OFFSET, address.getAddress());
if (address instanceof Inet4Address)
{
buffer.putShort(offset + ADDRESS_TYPE_OFFSET, ADDRESS_TYPE_IPV4);
buffer.setMemory(
offset + ADDRESS_OFFSET + IPV4_ADDRESS_LENGTH, IPV6_ADDRESS_LENGTH - IPV4_ADDRESS_LENGTH, (byte)0);
}
else if (address instanceof Inet6Address)
{
buffer.putShort(offset + ADDRESS_TYPE_OFFSET, ADDRESS_TYPE_IPV6);
}
else
{
throw new IllegalArgumentException("Unknown address type:" + address.getClass().getSimpleName());
}
return this;
}
/**
* Get the source address of this error frame.
*
* @return source address of the error frame.
*/
public InetSocketAddress sourceAddress()
{
final short addressType = buffer.getShort(offset + ADDRESS_TYPE_OFFSET);
final int port = buffer.getShort(offset + ADDRESS_PORT_OFFSET) & 0xFFFF;
final byte[] address;
if (ADDRESS_TYPE_IPV4 == addressType)
{View on GitHub (pinned to 6d60124e15)