{"record":{"id":"a8052408974f310b","repo":"Pumpkin-MC/Pumpkin","slug":"packet-is-not-supported-in-minecraft-version-0","errorCode":null,"errorMessage":"Packet is not supported in Minecraft version {0:?}","messagePattern":"Packet is not supported in Minecraft version (.+?)","errorType":"exception","errorClass":"WritingError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin-protocol/src/ser/mod.rs","lineNumber":43,"sourceCode":"    #[error(\"too large: {0}\")]\n    TooLarge(String),\n    #[error(\"{0}\")]\n    Message(String),\n}\n\nimpl serde::de::Error for ReadingError {\n    fn custom<T: std::fmt::Display>(msg: T) -> Self {\n        Self::Message(msg.to_string())\n    }\n}\n\n#[derive(Debug, Error)]\npub enum WritingError {\n    #[error(\"IO error: {0}\")]\n    IoError(#[from] std::io::Error),\n    #[error(\"Serde failure: {0}\")]\n    Serde(String),\n    #[error(\"Packet is not supported in Minecraft version {0:?}\")]\n    UnsupportedVersion(JavaMinecraftVersion),\n    #[error(\"Failed to serialize packet: {0}\")]\n    Message(String),\n}\n\nimpl serde::ser::Error for WritingError {\n    fn custom<T: std::fmt::Display>(msg: T) -> Self {\n        Self::Serde(msg.to_string())\n    }\n}\n\nstruct NetworkReadDataSource<'a, R: NetworkReadExt + ?Sized>(&'a mut R);\n\nimpl<'a, R: NetworkReadExt + ?Sized> pumpkin_nbt::deserializer::NbtDataSource<'a>\n    for NetworkReadDataSource<'a, R>\n{\n    fn read_u8(&mut self) -> Result<u8, pumpkin_nbt::Error> {\n        self.0.get_u8().map_err(|e| {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-protocol/src/ser/mod.rs#L25-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the packet's supported version range (or the player's protocol version) before sending; skip or substitute an equivalent packet for that version.","Use the library's version-gated send helpers that filter packets by negotiated version.","Update the library to gain support for the packet on the target version.","In plugin code, branch on MinecraftVersion before constructing version-specific packets."],"exampleFix":"// before: sending unconditionally\nplayer.send_packet(&AddEntityEffectPacket { ... });\n\n// after: gate on the client's version\nif player.protocol_version() >= V1_20_5 {\n    player.send_packet(&AddEntityEffectPacket { ... });\n} else {\n    player.send_packet(&legacy_equivalent);\n}","handlingStrategy":"validation","validationCode":"// gate packets on the negotiated protocol version before sending\nfn can_send(v: JavaMinecraftVersion) -> bool { v >= JavaMinecraftVersion::V1_20_5 }\nif !can_send(player.version()) { send_legacy_alternative(player); }","typeGuard":null,"tryCatchPattern":"match player.send_packet(&pkt).await {\n    Err(WritingError::UnsupportedVersion(v)) => {\n        debug!(\"packet unsupported for {v:?}; using fallback\");\n        player.send_packet(&fallback_packet).await?;\n    }\n    other => /* ... */,\n}","preventionTips":["Always consult the player's protocol version before version-sensitive packets.","In multi-version deployments, route packets through version-aware helper APIs.","Keep the protocol library updated when new Minecraft versions ship."],"tags":["rust","protocol","versioning","minecraft","compatibility"],"backgroundTag":"unsupported-operation","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}