{"record":{"id":"32e7f2205476d879","repo":"Pumpkin-MC/Pumpkin","slug":"unknown-inventory-transaction-type","errorCode":null,"errorMessage":"Unknown inventory transaction type: {}","messagePattern":"Unknown inventory transaction type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/pumpkin-protocol/src/bedrock/server/inventory_transaction.rs","lineNumber":214,"sourceCode":"                ErrorKind::InvalidData,\n                \"missing inventory action data\",\n            ));\n        }\n        let actions_len = collection_length(buf, \"inventory actions\")?;\n        let mut actions = Vec::with_capacity(actions_len);\n        for _ in 0..actions_len {\n            actions.push(InventoryAction::read(buf)?);\n        }\n        let has_value = !actions.is_empty();\n\n        let transaction_data = match transaction_type.0 {\n            0 => TransactionData::Normal(NormalTransactionData::read(buf)?),\n            1 => TransactionData::Mismatch(MismatchTransactionData::read(buf)?),\n            2 => TransactionData::UseItem(UseItemTransactionData::read(buf)?),\n            3 => TransactionData::UseItemOnEntity(UseItemOnEntityTransactionData::read(buf)?),\n            4 => TransactionData::ReleaseItem(ReleaseItemTransactionData::read(buf)?),\n            _ => {\n                return Err(Error::new(\n                    ErrorKind::InvalidData,\n                    format!(\"Unknown inventory transaction type: {}\", transaction_type.0),\n                ));\n            }\n        };\n\n        Ok(Self {\n            legacy_request_id,\n            legacy_set_item_slots,\n            has_value,\n            actions,\n            transaction_type,\n            transaction_data,\n        })\n    }\n}\n\n#[cfg(test)]","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-protocol/src/bedrock/server/inventory_transaction.rs#L196-L232","documentation":"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.","triggerScenarios":"Triggered when the decoded transaction_type.0 is >= 5 (or otherwise unmatched) in the match in InventoryTransactionPacket::read.","commonSituations":"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.","solutions":["Update the server library to a version supporting the client's protocol/transaction types.","Check the client's protocol version and downgrade it if it sends newer transaction types.","Log the numeric value to identify whether it's a known-but-unmapped type or corruption.","Verify varint decoding alignment; a misaligned varint can yield an arbitrary large type value."],"exampleFix":"// server before: unknown types rejected\n_ => return Err(Error::new(ErrorKind::InvalidData, format!(\"Unknown inventory transaction type: {}\", transaction_type.0))),\n// after (if the new type is legitimately supported): add an arm\n5 => TransactionData::NewKind(NewTransactionData::read(buf)?),","handlingStrategy":"validation","validationCode":"fn is_known_transaction_type(t: u32) -> bool {\n    matches!(t, 0..=4) // Normal, Mismatch, UseItem, UseItemOnEntity, ReleaseItem\n}","typeGuard":null,"tryCatchPattern":"match InventoryTransactionPacket::read(buf) {\n    Err(e) if e.to_string().starts_with(\"Unknown inventory transaction type\") => {\n        log::warn!(\"{e}; client may use a newer protocol\");\n        // drop packet or negotiate a lower protocol version with the peer\n    }\n    other => other?,\n}","preventionTips":["Pin client protocol versions to ones the server supports","Update the server library when clients adopt new transaction types","Log the numeric type value to distinguish corruption from genuinely new types"],"tags":["bedrock","protocol","inventory","enum","packet-decoding"],"backgroundTag":"invalid-enum-value","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}