{"record":{"id":"53a1e956be196ec2","repo":"Pumpkin-MC/Pumpkin","slug":"authentication-servers-are-down","errorCode":null,"errorMessage":"Authentication servers are down","messagePattern":"Authentication servers are down","errorType":"exception","errorClass":"AuthError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/net/authentication.rs","lineNumber":395,"sourceCode":"            }\n            other => {\n                last_unknown_status = Some(other);\n            }\n        }\n    }\n\n    if not_found_count > 0 {\n        Ok(None)\n    } else if let Some(status) = last_unknown_status {\n        Err(AuthError::UnknownStatusCode(status))\n    } else {\n        Err(AuthError::FailedResponse)\n    }\n}\n\n#[derive(Error, Debug)]\npub enum AuthError {\n    #[error(\"Authentication servers are down\")]\n    FailedResponse,\n    #[error(\"Failed to verify username\")]\n    UnverifiedUsername,\n    #[error(\"You are banned from Authentication servers\")]\n    Banned,\n    #[error(\"Texture Error {0}\")]\n    TextureError(TextureError),\n    #[error(\"You have disallowed actions from Authentication servers\")]\n    DisallowedAction,\n    #[error(\"Failed to parse JSON into Game Profile\")]\n    FailedParse,\n    #[error(\"Unknown Status Code {0}\")]\n    UnknownStatusCode(StatusCode),\n}\n\n#[derive(Error, Debug)]\npub enum TextureError {\n    #[error(\"Invalid URL\")]","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/net/authentication.rs#L377-L413","documentation":"PacketDecodeError::MalformedLength(String) is raised when the packet's length prefix cannot be parsed as a valid VarInt. Minecraft's protocol encodes lengths as variable-length integers with strict continuation-bit rules; a byte sequence violating those rules carries the offending detail in the String payload. This indicates the stream is not a valid packet stream.","triggerScenarios":"Reading a packet whose length VarInt has too many bytes (more than 5) or a continuation bit set past the maximum; garbage bytes where a length should be (e.g. after a protocol mismatch).","commonSituations":"A legacy/unsupported client version speaking the wrong protocol; a non-Minecraft client connecting to the port; reading from a stream that is offset mid-VarInt after an earlier decode error.","solutions":["Close the connection: once framing is misaligned the stream cannot be recovered reliably.","Verify client and server are using a compatible protocol version.","Check that previous decode steps consumed the correct number of bytes so the reader is aligned at a VarInt boundary.","Log the detail string to identify the malformed byte sequence and its source."],"exampleFix":"// before\nlet len = read_var_int_raw(stream).await?; // accepts >5-byte VarInts\n// after\nlet len = read_var_int_raw(stream).await?;\nif bytes_read > 5 {\n    return Err(PacketDecodeError::MalformedLength(format!(\"VarInt too long: {} bytes\", bytes_read)));\n}","handlingStrategy":"try-catch","validationCode":"fn var_int_len_ok(bytes: &[u8]) -> bool {\n    bytes.iter().take(5).position(|b| b & 0x80 == 0).is_some() && !bytes.is_empty()\n}","typeGuard":null,"tryCatchPattern":"match decode_packet(stream).await {\n    Err(PacketDecodeError::MalformedLength(detail)) => {\n        error!(\"malformed length VarInt: {detail}; closing connection\");\n        stream.shutdown().await.ok();\n    }\n    Ok(p) => handle(p),\n    Err(e) => warn!(\"decode error: {e}\"),\n}","preventionTips":["Verify protocol version compatibility before reading packets.","Keep the reader aligned at VarInt boundaries after every decode step.","Cap VarInt reads at 5 bytes per the Minecraft spec.","Log the offending bytes to detect non-Minecraft clients hitting the port."],"tags":["protocol","varint","packet-decoding","network"],"backgroundTag":"invalid-argument-format","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}