Pumpkin-MC/Pumpkin · error · AuthError

Failed to verify username

Error message

Failed to verify username

What it means

PacketDecodeError::FailedDecompression(String) is raised when zlib decompression of a compressed packet payload fails. Once compression is negotiated (Set Compression), every packet is zlib-framed; if the payload is not valid zlib data the decompressor errors and the detail string carries the underlying cause. The library also auto-wraps ReadingError into this variant via From<ReadingError>.

Solutions

  1. Confirm both sides agree on the compression state (the Set Compression packet was sent and applied).
  2. Validate the decompressed length against the declared packet length after decompression.
  3. Log the detail string to identify the zlib failure cause (bad header, truncated stream, etc.).
  4. Close the connection — decompression failures indicate corrupted or hostile framing.

Example fix

// before
let data = ZlibDecoder::new(&payload[..]).read_to_end()?;
// after
let data = ZlibDecoder::new(&payload[..]).read_to_end()
    .map_err(|e| PacketDecodeError::FailedDecompression(e.to_string()))?;
Defensive patterns

Strategy: try-catch

Validate before calling

fn is_probable_zlib(data: &[u8]) -> bool {
    data.len() >= 2 && data[0] & 0x0f == 0x08
}

Try / catch

match decode_packet(stream).await {
    Err(PacketDecodeError::FailedDecompression(detail)) => {
        error!("zlib failure: {detail}");
        // verify compression negotiation state, then close
    }
    Ok(p) => handle(p),
    Err(e) => warn!("decode error: {e}"),
}

Prevention

When it happens

Trigger: Receiving a packet with compression enabled whose body is not valid zlib data; decompressor invoked on an already-plain packet; an underlying ReadingError converted through the From impl.

Common situations: Client and server disagree on whether compression was enabled; corrupted data from a flaky network path being interpreted as zlib; proxies/middleboxes mangling the stream.

Understand the failure class

Background: "Invalid JSON response" and "Failed to parse response" errors: when an API answers 200 but the body isn't the JSON your library expected — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

                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")]
    InvalidURL,
    #[error("Invalid URL scheme for player texture: {0}")]

View on GitHub (pinned to 8d4639e25a)