{"record":{"id":"7f30cb3302499c93","repo":"Pumpkin-MC/Pumpkin","slug":"unknown-stack-request-item-descriptor-type-descri","errorCode":null,"errorMessage":"unknown stack request item descriptor type {descriptor_type}","messagePattern":"unknown stack request item descriptor type (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/pumpkin-protocol/src/bedrock/server/item_stack_request.rs","lineNumber":47,"sourceCode":"\n#[derive(Debug)]\npub struct StackRequestItem {\n    pub identifier: Option<String>,\n    pub metadata_value: VarInt,\n    pub count: u16,\n    pub block_runtime_id: VarUInt,\n    pub extra_data: Vec<u8>,\n}\n\nimpl PacketRead for StackRequestItem {\n    fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {\n        let descriptor_type = VarUInt::read(reader)?.0;\n        let _legacy_type = u8::read(reader)?;\n        let (identifier, metadata_value) = match descriptor_type {\n            0 => (None, VarInt(0)),\n            1 => (Some(String::read(reader)?), VarInt::read(reader)?),\n            _ => {\n                return Err(Error::new(\n                    ErrorKind::InvalidData,\n                    format!(\"unknown stack request item descriptor type {descriptor_type}\"),\n                ));\n            }\n        };\n        let count = i16::read(reader)? as u16;\n        let block_runtime_id = VarUInt::read(reader)?;\n        let data_len = VarUInt::read(reader)?.0 as usize;\n        if data_len > 1_048_576 {\n            return Err(Error::new(\n                ErrorKind::InvalidData,\n                \"extra_data length exceeds limit\",\n            ));\n        }\n        let mut extra_data = vec![0; data_len];\n        reader.read_exact(&mut extra_data)?;\n        Ok(Self {\n            identifier,","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-protocol/src/bedrock/server/item_stack_request.rs#L29-L65","documentation":"Thrown when decoding an ItemStackRequest item descriptor whose descriptor_type VarUInt is neither 0 (invalid/none descriptor) nor 1 (string identifier with metadata). The wire format only defines these two variants, so any other value means the stream is not a valid descriptor. Parsing aborts with an InvalidData error.","triggerScenarios":"A client sends an ItemStackRequest containing an item descriptor with descriptor_type >= 2, usually due to a protocol version mismatch, corrupted stream, or a crafted packet.","commonSituations":"Mismatched Bedrock protocol versions after a game update, modified clients, or packet fuzzing hitting the item-stack-request route.","solutions":["Align client and server Bedrock protocol versions","Decode the packet manually (offsets before the descriptor) to confirm which bytes were read as descriptor_type","Add support for the new descriptor type in the decoder if a newer protocol defines it"],"exampleFix":"// before (crafting a descriptor)\nlet descriptor_type: VarUInt = VarUInt(2);\n// after\nlet descriptor_type: VarUInt = VarUInt(1); // 0 or 1 only","handlingStrategy":"validation","validationCode":"fn is_valid_descriptor_type(t: u32) -> bool { matches!(t, 0 | 1) }","typeGuard":"fn known_descriptor_type(t: u32) -> Option<DescriptorType> { match t { 0 => Some(DescriptorType::None), 1 => Some(DescriptorType::Item), _ => None } }","tryCatchPattern":"match read_item_descriptor(reader) {\n    Err(e) if e.to_string().contains(\"unknown stack request item descriptor\") => log_malformed(peer, e),\n    Err(e) => return Err(e),\n    Ok(d) => Ok(d),\n}","preventionTips":["Update protocol definitions when Minecraft Bedrock versions change","Fuzz-test the descriptor decoder with random type bytes","Reject misbehaving clients after repeated malformed packets"],"tags":["protocol","bedrock","deserialization","invalid-enum"],"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"}