Pumpkin-MC/Pumpkin · error · EncryptionError

shared secret has the wrong length

Error message

shared secret has the wrong length

What it means

EncryptionError::SharedWrongLength; the shared secret decrypted from the client's encryption response has the wrong byte length (expected 16 bytes for AES), so it cannot be used as the symmetric key and the handshake fails.

Solutions

  1. Disconnect the client with an encryption-error kick
  2. Check the secret length is 16 bytes before enabling AES-CFB8
  3. Log the mismatch at debug level
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/pumpkin/src/net/mod.rs:426 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at crates/pumpkin/src/net/mod.rs:426

            Some(expires) => text.add_child(TextComponent::translate_cross(
                translation::java::MULTIPLAYER_DISCONNECT_BANNED_IP_EXPIRATION,
                translation::java::MULTIPLAYER_DISCONNECT_BANNED_IP_EXPIRATION,
                [TextComponent::text(
                    expires.format(FORMAT_DESCRIPTION).unwrap_or_default(),
                )],
            )),
            None => text,
        });
    }

    None
}

#[derive(Error, Debug)]
pub enum EncryptionError {
    #[error("failed to decrypt shared secret")]
    FailedDecrypt,
    #[error("shared secret has the wrong length")]
    SharedWrongLength,
    #[error("encryption is already enabled")]
    AlreadyEncrypted,
    #[error("no encryption request is pending")]
    NoPendingVerifyToken,
    #[error("verify token does not match")]
    VerifyTokenMismatch,
}

fn is_valid_player_name(name: &str) -> bool {
    if name.len() > 16 {
        return false;
    }
    !name.chars().any(|c| c.is_control() || c == ' ')
}

#[derive(Clone, Copy, Debug)]
pub enum DisconnectReason {

View on GitHub (pinned to 8d4639e25a)