{"record":{"id":"2b433dc618253d3b","repo":"Pumpkin-MC/Pumpkin","slug":"shared-secret-has-the-wrong-length","errorCode":null,"errorMessage":"shared secret has the wrong length","messagePattern":"shared secret has the wrong length","errorType":"exception","errorClass":"EncryptionError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/net/mod.rs","lineNumber":426,"sourceCode":"            Some(expires) => text.add_child(TextComponent::translate_cross(\n                translation::java::MULTIPLAYER_DISCONNECT_BANNED_IP_EXPIRATION,\n                translation::java::MULTIPLAYER_DISCONNECT_BANNED_IP_EXPIRATION,\n                [TextComponent::text(\n                    expires.format(FORMAT_DESCRIPTION).unwrap_or_default(),\n                )],\n            )),\n            None => text,\n        });\n    }\n\n    None\n}\n\n#[derive(Error, Debug)]\npub enum EncryptionError {\n    #[error(\"failed to decrypt shared secret\")]\n    FailedDecrypt,\n    #[error(\"shared secret has the wrong length\")]\n    SharedWrongLength,\n    #[error(\"encryption is already enabled\")]\n    AlreadyEncrypted,\n    #[error(\"no encryption request is pending\")]\n    NoPendingVerifyToken,\n    #[error(\"verify token does not match\")]\n    VerifyTokenMismatch,\n}\n\nfn is_valid_player_name(name: &str) -> bool {\n    if name.len() > 16 {\n        return false;\n    }\n    !name.chars().any(|c| c.is_control() || c == ' ')\n}\n\n#[derive(Clone, Copy, Debug)]\npub enum DisconnectReason {","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/net/mod.rs#L408-L444","documentation":"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.","triggerScenarios":"Thrown at crates/pumpkin/src/net/mod.rs:426 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Disconnect the client with an encryption-error kick","Check the secret length is 16 bytes before enabling AES-CFB8","Log the mismatch at debug level"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}