Pumpkin-MC/Pumpkin · error · AuthError

Authentication servers are down

Error message

Authentication servers are down

What it means

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.

Solutions

  1. Close the connection: once framing is misaligned the stream cannot be recovered reliably.
  2. Verify client and server are using a compatible protocol version.
  3. Check that previous decode steps consumed the correct number of bytes so the reader is aligned at a VarInt boundary.
  4. Log the detail string to identify the malformed byte sequence and its source.

Example fix

// before
let len = read_var_int_raw(stream).await?; // accepts >5-byte VarInts
// after
let len = read_var_int_raw(stream).await?;
if bytes_read > 5 {
    return Err(PacketDecodeError::MalformedLength(format!("VarInt too long: {} bytes", bytes_read)));
}
Defensive patterns

Strategy: try-catch

Validate before calling

fn var_int_len_ok(bytes: &[u8]) -> bool {
    bytes.iter().take(5).position(|b| b & 0x80 == 0).is_some() && !bytes.is_empty()
}

Try / catch

match decode_packet(stream).await {
    Err(PacketDecodeError::MalformedLength(detail)) => {
        error!("malformed length VarInt: {detail}; closing connection");
        stream.shutdown().await.ok();
    }
    Ok(p) => handle(p),
    Err(e) => warn!("decode error: {e}"),
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at crates/pumpkin/src/net/authentication.rs:395

            }
            other => {
                last_unknown_status = Some(other);
            }
        }
    }

    if not_found_count > 0 {
        Ok(None)
    } else if let Some(status) = last_unknown_status {
        Err(AuthError::UnknownStatusCode(status))
    } else {
        Err(AuthError::FailedResponse)
    }
}

#[derive(Error, Debug)]
pub enum AuthError {
    #[error("Authentication servers are down")]
    FailedResponse,
    #[error("Failed to verify username")]
    UnverifiedUsername,
    #[error("You are banned from Authentication servers")]
    Banned,
    #[error("Texture Error {0}")]
    TextureError(TextureError),
    #[error("You have disallowed actions from Authentication servers")]
    DisallowedAction,
    #[error("Failed to parse JSON into Game Profile")]
    FailedParse,
    #[error("Unknown Status Code {0}")]
    UnknownStatusCode(StatusCode),
}

#[derive(Error, Debug)]
pub enum TextureError {
    #[error("Invalid URL")]

View on GitHub (pinned to 8d4639e25a)