{"record":{"id":"2790f797dc3130b6","repo":"Pumpkin-MC/Pumpkin","slug":"missing-inventory-action-data","errorCode":null,"errorMessage":"missing inventory action data","messagePattern":"missing inventory action data","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/pumpkin-protocol/src/bedrock/server/inventory_transaction.rs","lineNumber":195,"sourceCode":"        let mut legacy_set_item_slots = Vec::new();\n        if has_legacy_slots {\n            let len = collection_length(buf, \"legacy item slot groups\")?;\n            legacy_set_item_slots.reserve(len);\n            for _ in 0..len {\n                legacy_set_item_slots.push(LegacySetItemSlot::read(buf)?);\n            }\n        }\n\n        if !bool::read(buf)? {\n            return Err(Error::new(\n                ErrorKind::InvalidData,\n                \"missing inventory transaction type\",\n            ));\n        }\n        let transaction_type = VarUInt::read(buf)?;\n\n        if !bool::read(buf)? {\n            return Err(Error::new(\n                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            _ => {","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-protocol/src/bedrock/server/inventory_transaction.rs#L177-L213","documentation":"Thrown while decoding InventoryTransactionPacket when the presence bool before the inventory actions list is false. The library requires the actions collection to be present in every transaction packet.","triggerScenarios":"Triggered by InventoryTransactionPacket::read when bool::read(buf) returns false immediately after reading the transaction_type VarUInt.","commonSituations":"Stream desynchronization after a misread field, client implementations omitting the actions presence flag, protocol version differences in the packet layout.","solutions":["Verify the transaction type VarUInt was read with correct varint encoding (a truncated varint shifts everything after).","Ensure the client writes a true presence bool before the actions length.","Check protocol version agreement for InventoryTransactionPacket field order.","Hand-decode the raw bytes from the packet start to find where the stream diverged."],"exampleFix":"// sender before: omitting actions presence flag\nwrite_varuint(buf, actions.len())?;\n// after\nbuf.push(0x01); // presence bool: true\nwrite_varuint(buf, actions.len())?;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match InventoryTransactionPacket::read(buf) {\n    Err(e) if e.to_string().contains(\"missing inventory action data\") => {\n        log::warn!(\"transaction packet missing required actions flag: {e}; dropping\");\n    }\n    other => other?,\n}","preventionTips":["Always write the presence bool (true) before the actions length","Verify the transaction type varint decoded correctly before actions","Keep protocol versions matched so field order agrees"],"tags":["bedrock","protocol","inventory","packet-decoding"],"backgroundTag":"missing-required-argument","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"}