Pumpkin-MC/Pumpkin · error
Unknown Text Type
Error message
Unknown Text Type
What it means
Thrown when decoding a Bedrock Text packet whose type byte does not map to any known TextPacketType (valid values are 0–11: raw, chat, tip, etc.). Unknown type means the packet layout cannot be interpreted, so decoding fails with InvalidData.
Solutions
- Update the pumpkin-protocol crate to support the client's Bedrock protocol version
- Check for proxies or plugins rewriting Text packets
- Capture raw bytes to identify the unknown type value
- Disconnect the client if packets are deliberately malformed
Example fix
// before
match t {
... 11 => Ok(Self::JsonAnnouncement),
_ => Err(Error::new(ErrorKind::InvalidData, "Unknown Text Type")),
}
// after (support a new type 12)
match t {
... 11 => Ok(Self::JsonAnnouncement),
12 => Ok(Self::NewTextType),
_ => Err(Error::new(ErrorKind::InvalidData, "Unknown Text Type")),
} Defensive patterns
Strategy: try-catch
Validate before calling
fn is_known_text_type(b: u8) -> bool { b <= 11 } // guard raw bytes before decode if available Type guard
fn parse_text_type(b: u8) -> Option<TextPacketType> { TextPacketType::read(&mut &b.to_vec()[..]).ok() } Try / catch
match TextPacketType::read(buf) {
Ok(t) => handle_text(t),
Err(e) if e.kind() == std::io::ErrorKind::InvalidData => { log::warn!("unknown text type from peer"); disconnect(peer); }
Err(e) => Err(e.into()),
} Prevention
- Keep the protocol crate updated when Bedrock adds new text types
- Never inject text packets from plugins without encoding the type via the protocol crate
- Add round-trip tests covering every TextPacketType variant
- Log the offending type byte to spot new protocol values quickly
When it happens
Trigger: Text packet where the type byte read from the buffer is outside 0..=11, e.g. due to misaligned parsing, corruption, or a newer client protocol adding a type this server doesn't know.
Common situations: Bedrock version mismatch (new text types in newer clients), chat plugins/proxies injecting malformed text packets, corrupted packets.
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 inventory transaction type
- Invalid ability value type
- invalid Bedrock respawn state
- Invalid ContainerName ID
- item string array length out of bounds
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/66e188760cef9515.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-protocol/src/bedrock/server/text.rs:303
}
}
impl PacketRead for TextPacketType {
fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {
match u8::read(reader)? {
0 => Ok(Self::Raw),
1 => Ok(Self::Chat),
2 => Ok(Self::Translation),
3 => Ok(Self::Popup),
4 => Ok(Self::JukeboxPopup),
5 => Ok(Self::Tip),
6 => Ok(Self::System),
7 => Ok(Self::Whisper),
8 => Ok(Self::Announcement),
9 => Ok(Self::JsonWhisper),
10 => Ok(Self::Json),
11 => Ok(Self::JsonAnnouncement),
_ => Err(Error::new(ErrorKind::InvalidData, "Unknown Text Type")),
}
}
}
impl<'a> PacketReadSlice<'a> for TextPacketType {
fn read_slice(buf: &mut &'a [u8]) -> Result<Self, Error> {
match u8::read_slice(buf)? {
0 => Ok(Self::Raw),
1 => Ok(Self::Chat),
2 => Ok(Self::Translation),
3 => Ok(Self::Popup),
4 => Ok(Self::JukeboxPopup),
5 => Ok(Self::Tip),
6 => Ok(Self::System),
7 => Ok(Self::Whisper),
8 => Ok(Self::Announcement),
9 => Ok(Self::JsonWhisper),
10 => Ok(Self::Json),View on GitHub (pinned to 8d4639e25a)