Pumpkin-MC/Pumpkin · error

unknown item descriptor type

Error message

unknown item descriptor type {descriptor_type}

What it means

Thrown when decoding an item descriptor whose descriptor_type is outside the supported set (0..=3: invalid, item, item-with-block, destructive-tag descriptor). Unknown values mean the stream does not conform to any known descriptor encoding. The decoder returns an InvalidData error and drops the packet.

Solutions

  1. Match client and server protocol versions
  2. If a newer protocol defines additional descriptor types, extend the match in item_stack_request.rs
  3. Inspect the raw bytes at the descriptor offset to confirm the type value actually read

Example fix

// before
let descriptor_type: VarUInt = VarUInt(7);
// after
let descriptor_type: VarUInt = VarUInt(1); // supported: 0..=3
Defensive patterns

Strategy: validation

Validate before calling

fn supported_descriptor(t: u32) -> bool { t <= 3 }

Type guard

fn to_descriptor_kind(t: u32) -> Option<DescriptorKind> { DescriptorKind::from_u32(t) }

Try / catch

if let Err(e) = decode(reader) {
    if e.to_string().contains("unknown item descriptor type") { skip_packet(peer); return Ok(()); }
    return Err(e.into());
}

Prevention

When it happens

Trigger: A client sends an ItemStackRequest/creative-content style descriptor with descriptor_type >= 4; caused by protocol mismatch, malformed data, or a fuzzed packet.

Common situations: Bedrock version skew after a game update adding new descriptor kinds; custom clients; replaying old captures against a newer decoder.

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/f0f3a7bd29db7292. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin-protocol/src/bedrock/server/item_stack_request.rs:265

fn skip_autocraft_ingredient<R: Read>(reader: &mut R) -> Result<(), Error> {
    let descriptor_type = VarUInt::read(reader)?.0;
    let _legacy_type = u8::read(reader)?;
    match descriptor_type {
        0 => {}
        1 => {
            let _identifier = String::read(reader)?;
            let _aux = VarInt::read(reader)?;
        }
        2 => {
            let _expression = String::read(reader)?;
            let _version = i16::read(reader)?;
        }
        3 => {
            let _tag = String::read(reader)?;
        }
        _ => {
            return Err(Error::new(
                ErrorKind::InvalidData,
                format!("unknown item descriptor type {descriptor_type}"),
            ));
        }
    }
    let _count = u16::read(reader)?;
    Ok(())
}

#[derive(Debug)]
pub struct ItemStackRequest {
    pub request_id: VarInt,
    pub actions: Vec<ItemStackRequestAction>,
    pub filter_strings: Vec<String>,
    pub filter_cause: i32,
}

impl PacketRead for ItemStackRequest {

View on GitHub (pinned to 8d4639e25a)