apache/cassandra · error · IllegalArgumentException

Unknown kind: {kind}

Error message

Unknown kind: {kind}

What it means

TxnData.Kind.from(byte) decodes the one-byte discriminator for transaction data kinds: 0=RETURNING? (per switch: 0/1→RETURNING variants), 2=AUTO_READ, 3=CAS_READ. Any other byte indicates an unknown or future-version kind and throws IllegalArgumentException. This is a deserialization guard against peers writing kinds this build does not understand.

Source

Thrown at src/java/org/apache/cassandra/service/accord/txn/TxnData.java:82

        TxnDataNameKind(byte value)
        {
            this.value = value;
        }

        public static TxnDataNameKind from(byte b)
        {
            switch (b)
            {
                case 0:
                    return USER;
                case 1:
                    return RETURNING;
                case 2:
                    return AUTO_READ;
                case 3:
                    return CAS_READ;
                default:
                    throw new IllegalArgumentException("Unknown kind: " + b);
            }
        }
    }

    public static int txnDataName(TxnDataNameKind kind, int index)
    {
        requireArgument(index >= 0 && index <= TXN_DATA_NAME_INDEX_MAX);
        int kindInt = (int)(((long)kind.value) << TXN_DATA_NAME_INDEX_BITS);
        return kindInt | index;
    }

    public static int txnDataName(TxnDataNameKind kind)
    {
        return txnDataName(kind, 0);
    }

    public static TxnDataNameKind txnDataNameKind(int txnDataName)
    {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Upgrade this node to a build that knows the new kind.
  2. Verify sender and receiver builds match before exchanging Accord traffic.
  3. Add the missing kind constant and mapping before enabling traffic from upgraded peers.
Defensive patterns

Strategy: validation

Validate before calling

byte b = readKindByte(payload);
if (b < 0 || b > 3) throw new IllegalArgumentException("Unknown TxnData kind byte: " + b);

Try / catch

try {
    TxnData.Kind kind = TxnData.Kind.from(b);
} catch (IllegalArgumentException e) {
    logger.error("Unknown TxnData kind {} from peer", b, e);
    dropAndRequestResync(peer);
}

Prevention

When it happens

Trigger: Calling TxnData.Kind.from(b) with a byte outside {0,1,2,3}, typically while deserializing a transaction data payload from a newer build that added a kind.

Common situations: Rolling upgrade where a new TxnData kind was introduced; corrupted transport payload; tests crafting out-of-range kind bytes.

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 apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/9665d11fc52b0ada. Report an issue: GitHub.