Pumpkin-MC/Pumpkin · error · WritingError

Packet is not supported in Minecraft version

Error message

Packet is not supported in Minecraft version {0:?}

What it means

WritingError::UnsupportedVersion is raised when attempting to serialize a packet that the target Minecraft version (JavaMinecraftVersion) does not support — the packet type was added in a later protocol version (or removed earlier), so encoding it would produce a packet the peer cannot parse. The library checks the packet's supported-version range against the negotiated protocol version during the write path.

Solutions

  1. Check the packet's supported version range (or the player's protocol version) before sending; skip or substitute an equivalent packet for that version.
  2. Use the library's version-gated send helpers that filter packets by negotiated version.
  3. Update the library to gain support for the packet on the target version.
  4. In plugin code, branch on MinecraftVersion before constructing version-specific packets.

Example fix

// before: sending unconditionally
player.send_packet(&AddEntityEffectPacket { ... });

// after: gate on the client's version
if player.protocol_version() >= V1_20_5 {
    player.send_packet(&AddEntityEffectPacket { ... });
} else {
    player.send_packet(&legacy_equivalent);
}
Defensive patterns

Strategy: validation

Validate before calling

// gate packets on the negotiated protocol version before sending
fn can_send(v: JavaMinecraftVersion) -> bool { v >= JavaMinecraftVersion::V1_20_5 }
if !can_send(player.version()) { send_legacy_alternative(player); }

Try / catch

match player.send_packet(&pkt).await {
    Err(WritingError::UnsupportedVersion(v)) => {
        debug!("packet unsupported for {v:?}; using fallback");
        player.send_packet(&fallback_packet).await?;
    }
    other => /* ... */,
}

Prevention

When it happens

Trigger: Writing a packet to a connection whose negotiated protocol version is outside the packet's supported range, e.g. sending a packet introduced in 1.20.5 to a 1.19 client, or a legacy packet to a modern client where it was removed/renamed.

Common situations: Multi-version server setups (ViaVersion-style proxies) where per-player protocol versions differ; plugins injecting packets without checking the player's version; testing a development build against an older client.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/a8052408974f310b. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin-protocol/src/ser/mod.rs:43

    #[error("too large: {0}")]
    TooLarge(String),
    #[error("{0}")]
    Message(String),
}

impl serde::de::Error for ReadingError {
    fn custom<T: std::fmt::Display>(msg: T) -> Self {
        Self::Message(msg.to_string())
    }
}

#[derive(Debug, Error)]
pub enum WritingError {
    #[error("IO error: {0}")]
    IoError(#[from] std::io::Error),
    #[error("Serde failure: {0}")]
    Serde(String),
    #[error("Packet is not supported in Minecraft version {0:?}")]
    UnsupportedVersion(JavaMinecraftVersion),
    #[error("Failed to serialize packet: {0}")]
    Message(String),
}

impl serde::ser::Error for WritingError {
    fn custom<T: std::fmt::Display>(msg: T) -> Self {
        Self::Serde(msg.to_string())
    }
}

struct NetworkReadDataSource<'a, R: NetworkReadExt + ?Sized>(&'a mut R);

impl<'a, R: NetworkReadExt + ?Sized> pumpkin_nbt::deserializer::NbtDataSource<'a>
    for NetworkReadDataSource<'a, R>
{
    fn read_u8(&mut self) -> Result<u8, pumpkin_nbt::Error> {
        self.0.get_u8().map_err(|e| {

View on GitHub (pinned to 8d4639e25a)