aeron-io/aeron · error · IllegalArgumentException

Unknown address type

Error message

Unknown address type:{addressType}

What it means

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.

Solutions

  1. Verify sender and receiver use the same Aeron version supporting the same address-type constants.
  2. Check the flyweight offset passed to sourceAddress() matches the frame layout (offset misalignment shifts the type field).
  3. Validate the addressType value before calling, treating unknown types as corrupt frames and dropping them.
  4. Re-encode the frame ensuring putShort(ADDRESS_TYPE_OFFSET, ADDRESS_TYPE_IPV4|IPV6) is used.

Example fix

// before
short type = buffer.getShort(offset + TYPE_OFF);
flyweight.sourceAddress(type); // throws for unknown values
// after
short type = buffer.getShort(offset + PublicationErrorFrameFlyweight.ADDRESS_TYPE_OFFSET);
if (type == PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV4 ||
    type == PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV6) {
    flyweight.sourceAddress(type);
}
Defensive patterns

Strategy: validation

Validate before calling

short type = buffer.getShort(offset + PublicationErrorFrameFlyweight.ADDRESS_TYPE_OFFSET);
if (type != PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV4 && type != PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV6) {
    throw new IllegalArgumentException("unsupported address type in frame: " + type);
}

Type guard

static boolean isKnownAddressType(short t) {
    return t == PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV4 || t == PublicationErrorFrameFlyweight.ADDRESS_TYPE_IPV6;
}

Try / catch

try { InetSocketAddress src = flyweight.sourceAddress(addressType); } catch (IllegalArgumentException e) { log.warn("Corrupt error frame, dropping", e); }

Prevention

When it happens

Trigger: 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.

Common situations: Version skew between sender and receiver of error frames; memory corruption or misaligned flyweight offset; custom protocol extensions not understood by this version.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12). Data as JSON: /api/errors/8ace83c2c4dc702e. Report an issue: GitHub.

Appendix: source

Thrown at aeron-client/src/main/java/io/aeron/command/PublicationErrorFrameFlyweight.java:302

     * @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)
        {
            address = new byte[IPV4_ADDRESS_LENGTH];
        }
        else if (ADDRESS_TYPE_IPV6 == addressType)
        {
            address = new byte[IPV6_ADDRESS_LENGTH];
        }
        else
        {
            throw new IllegalArgumentException("Unknown address type:" + addressType);
        }

        buffer.getBytes(offset + ADDRESS_OFFSET, address);
        try
        {
            return new InetSocketAddress(Inet4Address.getByAddress(address), port);
        }
        catch (final UnknownHostException ex)
        {
            throw new IllegalArgumentException("Unknown address type:" + addressType, ex);
        }

    }

    /**
     * Error code for the command.
     *
     * @return error code for the command.

View on GitHub (pinned to 6d60124e15)