Pumpkin-MC/Pumpkin · error
unknown stack request item descriptor type
Error message
unknown stack request item descriptor type {descriptor_type} What it means
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.
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
Example fix
// before (crafting a descriptor) let descriptor_type: VarUInt = VarUInt(2); // after let descriptor_type: VarUInt = VarUInt(1); // 0 or 1 only
Defensive patterns
Strategy: validation
Validate before calling
fn is_valid_descriptor_type(t: u32) -> bool { matches!(t, 0 | 1) } Type guard
fn known_descriptor_type(t: u32) -> Option<DescriptorType> { match t { 0 => Some(DescriptorType::None), 1 => Some(DescriptorType::Item), _ => None } } Try / catch
match read_item_descriptor(reader) {
Err(e) if e.to_string().contains("unknown stack request item descriptor") => log_malformed(peer, e),
Err(e) => return Err(e),
Ok(d) => Ok(d),
} Prevention
- Update protocol definitions when Minecraft Bedrock versions change
- Fuzz-test the descriptor decoder with random type bytes
- Reject misbehaving clients after repeated malformed packets
When it happens
Trigger: 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.
Common situations: Mismatched Bedrock protocol versions after a game update, modified clients, or packet fuzzing hitting the item-stack-request route.
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
- Unknown ItemStackRequestAction ID
- unknown item descriptor type
- invalid player input flag
- user_data_len exceeds 1MB limit
- extra_data_len exceeds 1MB limit
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/7f30cb3302499c93.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-protocol/src/bedrock/server/item_stack_request.rs:47
#[derive(Debug)]
pub struct StackRequestItem {
pub identifier: Option<String>,
pub metadata_value: VarInt,
pub count: u16,
pub block_runtime_id: VarUInt,
pub extra_data: Vec<u8>,
}
impl PacketRead for StackRequestItem {
fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {
let descriptor_type = VarUInt::read(reader)?.0;
let _legacy_type = u8::read(reader)?;
let (identifier, metadata_value) = match descriptor_type {
0 => (None, VarInt(0)),
1 => (Some(String::read(reader)?), VarInt::read(reader)?),
_ => {
return Err(Error::new(
ErrorKind::InvalidData,
format!("unknown stack request item descriptor type {descriptor_type}"),
));
}
};
let count = i16::read(reader)? as u16;
let block_runtime_id = VarUInt::read(reader)?;
let data_len = VarUInt::read(reader)?.0 as usize;
if data_len > 1_048_576 {
return Err(Error::new(
ErrorKind::InvalidData,
"extra_data length exceeds limit",
));
}
let mut extra_data = vec![0; data_len];
reader.read_exact(&mut extra_data)?;
Ok(Self {
identifier,View on GitHub (pinned to 8d4639e25a)