Pumpkin-MC/Pumpkin · info · AuthError

Texture Error

Error message

Texture Error {0}

What it means

PacketDecodeError::ConnectionClosed is raised when the connection is closed while a packet read/decode is in progress. The library surfaces this instead of treating a closed socket as a decode failure, letting callers distinguish normal disconnects from protocol errors. It typically means the peer (or network) ended the stream.

Solutions

  1. Treat this as a normal disconnect: clean up player/session state and stop reading from the connection.
  2. Distinguish it from real decode errors in logging (log at info/debug, not error).
  3. Ensure no further reads are attempted on the closed connection afterwards.
  4. Add idle/keepalive handling (keep-alive packets) to detect and manage dead connections gracefully.

Example fix

// before
match decode_packet(stream).await {
    Err(e) => error!("decode failed: {}", e), // treats normal disconnect as error
    Ok(p) => handle(p),
}
// after
match decode_packet(stream).await {
    Err(PacketDecodeError::ConnectionClosed) => info!("client disconnected"),
    Err(e) => warn!("decode failed: {}", e),
    Ok(p) => handle(p),
}
Defensive patterns

Strategy: try-catch

Try / catch

match decode_packet(stream).await {
    Err(PacketDecodeError::ConnectionClosed) => {
        info!("connection closed by peer");
        cleanup_session();
    }
    Ok(p) => handle(p),
    Err(e) => warn!("decode error: {e}"),
}

Prevention

When it happens

Trigger: A read on the packet stream returns end-of-file while the decoder is waiting for a packet length or body; the client disconnects between or during packet reads.

Common situations: Players quitting the game (normal client disconnect); client crash or network drop; idle timeouts on proxies closing the TCP connection.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


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

Appendix: source

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

    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}")]
    DisallowedUrlScheme(String),
    #[error("Invalid URL domain for player texture: {0}")]
    DisallowedUrlDomain(String),
    #[error("Failed to decode base64 player texture: {0}")]

View on GitHub (pinned to 8d4639e25a)