Pumpkin-MC/Pumpkin · error

Unknown inventory transaction type

Error message

Unknown inventory transaction type: {}

What it means

Thrown after decoding an InventoryTransactionPacket whose transaction_type VarUInt is not one of the known values 0-4 (Normal, Mismatch, UseItem, UseItemOnEntity, ReleaseItem). The message includes the unrecognized numeric type.

Solutions

  1. Update the server library to a version supporting the client's protocol/transaction types.
  2. Check the client's protocol version and downgrade it if it sends newer transaction types.
  3. Log the numeric value to identify whether it's a known-but-unmapped type or corruption.
  4. Verify varint decoding alignment; a misaligned varint can yield an arbitrary large type value.

Example fix

// server before: unknown types rejected
_ => return Err(Error::new(ErrorKind::InvalidData, format!("Unknown inventory transaction type: {}", transaction_type.0))),
// after (if the new type is legitimately supported): add an arm
5 => TransactionData::NewKind(NewTransactionData::read(buf)?),
Defensive patterns

Strategy: validation

Validate before calling

fn is_known_transaction_type(t: u32) -> bool {
    matches!(t, 0..=4) // Normal, Mismatch, UseItem, UseItemOnEntity, ReleaseItem
}

Try / catch

match InventoryTransactionPacket::read(buf) {
    Err(e) if e.to_string().starts_with("Unknown inventory transaction type") => {
        log::warn!("{e}; client may use a newer protocol");
        // drop packet or negotiate a lower protocol version with the peer
    }
    other => other?,
}

Prevention

When it happens

Trigger: Triggered when the decoded transaction_type.0 is >= 5 (or otherwise unmatched) in the match in InventoryTransactionPacket::read.

Common situations: A client running a newer protocol introducing new transaction types the server doesn't know, corrupted bytes inflating the varint, a custom client sending undefined type codes.

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 Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/32e7f2205476d879. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin-protocol/src/bedrock/server/inventory_transaction.rs:214

                ErrorKind::InvalidData,
                "missing inventory action data",
            ));
        }
        let actions_len = collection_length(buf, "inventory actions")?;
        let mut actions = Vec::with_capacity(actions_len);
        for _ in 0..actions_len {
            actions.push(InventoryAction::read(buf)?);
        }
        let has_value = !actions.is_empty();

        let transaction_data = match transaction_type.0 {
            0 => TransactionData::Normal(NormalTransactionData::read(buf)?),
            1 => TransactionData::Mismatch(MismatchTransactionData::read(buf)?),
            2 => TransactionData::UseItem(UseItemTransactionData::read(buf)?),
            3 => TransactionData::UseItemOnEntity(UseItemOnEntityTransactionData::read(buf)?),
            4 => TransactionData::ReleaseItem(ReleaseItemTransactionData::read(buf)?),
            _ => {
                return Err(Error::new(
                    ErrorKind::InvalidData,
                    format!("Unknown inventory transaction type: {}", transaction_type.0),
                ));
            }
        };

        Ok(Self {
            legacy_request_id,
            legacy_set_item_slots,
            has_value,
            actions,
            transaction_type,
            transaction_data,
        })
    }
}

#[cfg(test)]

View on GitHub (pinned to 8d4639e25a)