Pumpkin-MC/Pumpkin · error
Invalid ContainerName ID
Error message
Invalid ContainerName ID: {value} What it means
Returned by ContainerName::try_from/decode when the incoming varint ID does not map to any known ContainerName variant (valid IDs currently run 0..=66). The parser fails with InvalidData rather than inventing an unknown container variant.
Solutions
- Update the server/protocol crate to a version that maps the new ContainerName IDs.
- Check client version compatibility; pin or reject clients with unsupported protocol versions.
- Verify packet parsing alignment upstream — a desynced read turns ordinary data into invalid IDs.
- If extensibility is needed, add a fallback Unknown(i32) handling path instead of erroring.
Example fix
// before let name = ContainerName::from_id(value)?; // Err on 67 // after let name = ContainerName::from_id(value).unwrap_or(ContainerName::Dynamic); // or reject client
Defensive patterns
Strategy: try-catch
Validate before calling
fn known_container_id(v: u32) -> bool { v <= 66 } Try / catch
match ContainerName::decode(buf) {
Ok(name) => name,
Err(e) if e.to_string().starts_with("Invalid ContainerName ID") => {
log::warn!("unknown container id from client — update protocol? ");
ContainerName::Dynamic
}
Err(e) => return Err(e),
} Prevention
- Keep the server updated for new Bedrock container IDs.
- Validate client protocol version at handshake.
- Check for upstream desync when the invalid ID looks random.
When it happens
Trigger: Decoding a Bedrock packet that carries a ContainerName ID outside the recognized 0-66 range — newer/older client sending an ID this server build doesn't know, or stream desync producing a garbage value.
Common situations: Client on a newer Bedrock version introduces container IDs unknown to this server; corrupt packet misaligned so random bytes parse as the ID.
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
- user_data_len exceeds 1MB limit
- extra_data_len exceeds 1MB limit
- item string array length out of bounds
- String::from_utf8 error
- Nbt read error
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/92c2dc44b782f6b5.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-protocol/src/bedrock/network_item.rs:496
49 => Ok(Self::Trade2ResultPreview),
50 => Ok(Self::GrindstoneInput),
51 => Ok(Self::GrindstoneAdditional),
52 => Ok(Self::GrindstoneResultPreview),
53 => Ok(Self::StonecutterInput),
54 => Ok(Self::StonecutterResultPreview),
55 => Ok(Self::CartographyInput),
56 => Ok(Self::CartographyAdditional),
57 => Ok(Self::CartographyResultPreview),
58 => Ok(Self::Barrel),
59 => Ok(Self::Cursor),
60 => Ok(Self::CreatedOutput),
61 => Ok(Self::SmithingTableTemplate),
62 => Ok(Self::CrafterLevelEntity),
63 => Ok(Self::Dynamic),
64 => Ok(Self::RecipeFood),
65 => Ok(Self::RecipeBlocks),
66 => Ok(Self::RecipeFurnaceItems),
_ => Err(Error::new(
std::io::ErrorKind::InvalidData,
format!("Invalid ContainerName ID: {value}"),
)),
}
}
}
impl PacketWrite for ContainerName {
fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error> {
(*self as u8).write(writer)?;
Ok(())
}
}
impl PacketRead for ContainerName {
fn read<R: Read>(buf: &mut R) -> Result<Self, Error> {
let value = u8::read(buf)?;
Self::try_from(value)View on GitHub (pinned to 8d4639e25a)