aeron-io/aeron · error · IllegalStateException

unknown RES_TYPE=

Error message

unknown RES_TYPE=

What it means

ResolutionEntryFlyweight.putAddress throws IllegalStateException when the entry's resType() is not one of the known RES_TYPE values (RES_TYPE_NAME_TO_IP4_MD or RES_TYPE_NAME_TO_IP6_MD). The flyweight reads the type field from a raw network buffer, so an unknown value means the buffer is corrupted or a newer/older protocol version encoded a type this library does not understand.

Solutions

  1. Check resType() before calling putAddress and skip or log entries with unknown types
  2. Upgrade/align the Aeron client version to match the driver/media producing the entries
  3. Verify the buffer offset and contents — a corrupted or misaligned buffer can yield a garbage type value

Example fix

// before
entryFlyweight.putAddress(address);
// after
short resType = entryFlyweight.resType();
if (resType == ResolutionEntryFlyweight.RES_TYPE_NAME_TO_IP4_MD ||
    resType == ResolutionEntryFlyweight.RES_TYPE_NAME_TO_IP6_MD)
{
    entryFlyweight.putAddress(address);
}
Defensive patterns

Strategy: validation

Validate before calling

short rt = entry.resType();
boolean known = rt == ResolutionEntryFlyweight.RES_TYPE_NAME_TO_IP4_MD || rt == ResolutionEntryFlyweight.RES_TYPE_NAME_TO_IP6_MD;
if (!known) { /* skip/log entry */ }

Type guard

boolean isKnownResType(short rt) {
    return rt == ResolutionEntryFlyweight.RES_TYPE_NAME_TO_IP4_MD ||
           rt == ResolutionEntryFlyweight.RES_TYPE_NAME_TO_IP6_MD;
}

Try / catch

try { entry.putAddress(address); }
catch (IllegalStateException e) { log.warn("Skipping entry with unknown RES_TYPE", e); }

Prevention

When it happens

Trigger: Calling putAddress(...) on a ResolutionEntryFlyweight whose underlying buffer contains a resType value other than 0 (NAME_TO_IP4_MD) or 1 (NAME_TO_IP6_MD) in the type field.

Common situations: Decoding a resolution entry from an untrusted/corrupted UDP buffer; interoperating with an Aeron driver of a different version that defines new RES_TYPE constants; reusing a flyweight over uninitialized or zeroed memory with an out-of-range type byte.

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/30152a464043aa0e. Report an issue: GitHub.

Appendix: source

Thrown at aeron-client/src/main/java/io/aeron/protocol/ResolutionEntryFlyweight.java:260

        {
            case RES_TYPE_NAME_TO_IP4_MD:
                if (ADDRESS_LENGTH_IP4 != address.length)
                {
                    throw new IllegalArgumentException("Invalid address length: " + address.length);
                }
                putBytes(ADDRESS_FIELD_OFFSET, address, 0, ADDRESS_LENGTH_IP4);
                break;

            case RES_TYPE_NAME_TO_IP6_MD:
                if (ADDRESS_LENGTH_IP6 != address.length)
                {
                    throw new IllegalArgumentException("Invalid address length: " + address.length);
                }
                putBytes(ADDRESS_FIELD_OFFSET, address, 0, ADDRESS_LENGTH_IP6);
                break;

            default:
                throw new IllegalStateException("unknown RES_TYPE=" + resType());
        }

        return this;
    }

    /**
     * Get the address for the entry by copying it into the destination buffer.
     *
     * @param dstBuffer into which the address will be copied.
     * @return length of the address copied.
     */
    public int getAddress(final byte[] dstBuffer)
    {
        switch (resType())
        {
            case RES_TYPE_NAME_TO_IP4_MD:
                if (ADDRESS_LENGTH_IP4 > dstBuffer.length)
                {

View on GitHub (pinned to 6d60124e15)