{"record":{"id":"9c2aceb1e367347e","repo":"Pumpkin-MC/Pumpkin","slug":"failed-to-send-packet-0","errorCode":null,"errorMessage":"Failed to send packet: {0}","messagePattern":"Failed to send packet: (.+?)","errorType":"exception","errorClass":"PacketError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin-protocol/src/rcon.rs","lineNumber":54,"sourceCode":"    pub fn write_buf(self, id: i32, body: &str) -> BytesMut {\n        let mut buf = BytesMut::new();\n        // 10 is for 4 bytes ty, 4 bytes id, and 2 terminating nul bytes.\n        buf.put_i32_le(10 + body.len() as i32);\n        buf.put_i32_le(id);\n        buf.put_i32_le(self as i32);\n        let bytes = body.as_bytes();\n        buf.put_slice(bytes);\n        buf.put_u8(0);\n        buf.put_u8(0);\n        buf\n    }\n}\n\n#[derive(Error, Debug)]\npub enum PacketError {\n    #[error(\"Invalid length\")]\n    InvalidLength,\n    #[error(\"Failed to send packet: {0}\")]\n    FailedSend(std::io::Error),\n    #[error(\"Missing packet null terminator\")]\n    MissingNullTerminator,\n    #[error(\"Invalid packet string body: {0}\")]\n    InvalidBody(std::str::Utf8Error),\n    #[error(\"Unknown packet type: {0}\")]\n    UnknownPacketType(i32),\n}\n\n#[derive(Debug, PartialEq, Eq)]\n/// Serverbound packet\npub struct Packet {\n    id: i32,\n    ptype: ServerboundPacket,\n    body: Box<str>,\n}\n\nimpl Packet {","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-protocol/src/rcon.rs#L36-L72","documentation":"PacketError variant wrapping an io::Error raised when the RCON connection's write of a packet fails. It fires at the send site (socket write during write_buf/flush), meaning the TCP connection to the RCON client was broken or reset mid-send — the embedded error carries the OS-level cause.","triggerScenarios":"Thrown at crates/pumpkin-protocol/src/rcon.rs:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Terminate that RCON client session","Check socket state before writing responses","Log the io error at debug level"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}