{"record":{"id":"ec1ec10e3c6be738","repo":"Pumpkin-MC/Pumpkin","slug":"attempted-to-initialize-a-session-with-an-invalid","errorCode":null,"errorMessage":"attempted to initialize a session with an invalid public key","messagePattern":"attempted to initialize a session with an invalid public key","errorType":"exception","errorClass":"ChatError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/net/java/play/mod.rs","lineNumber":140,"sourceCode":"}\n\n#[derive(Debug, Error)]\npub enum ChatError {\n    #[error(\"sent an oversized message\")]\n    OversizedMessage,\n    #[error(\"sent a message with illegal characters\")]\n    IllegalCharacters,\n    #[error(\"sent a chat with invalid/no signature\")]\n    UnsignedChat,\n    #[error(\"has too many unacknowledged chats queued\")]\n    TooManyPendingChats,\n    #[error(\"sent a chat that couldn't be validated\")]\n    ChatValidationFailed,\n    #[error(\"sent a chat with an out of order timestamp\")]\n    OutOfOrderChat,\n    #[error(\"has an expired public key\")]\n    ExpiredPublicKey,\n    #[error(\"attempted to initialize a session with an invalid public key\")]\n    InvalidPublicKey,\n}\n\nimpl PumpkinError for ChatError {\n    fn is_kick(&self) -> bool {\n        true\n    }\n\n    fn severity(&self) -> Level {\n        Level::WARN\n    }\n\n    fn client_kick_reason(&self) -> Option<String> {\n        match self {\n            Self::OversizedMessage => Some(\"Chat message too long\".into()),\n            Self::IllegalCharacters => Some(\n                TextComponent::translate_cross(\n                    translation::java::MULTIPLAYER_DISCONNECT_ILLEGAL_CHARACTERS,","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/net/java/play/mod.rs#L122-L158","documentation":"ChatError sentinel raised while initializing the chat session: the public key the client sent (with its key/payload) could not be parsed or accepted as a valid signing key. Fires at session setup when the client's key data is malformed, from an untrusted source, or does not match expectations. The faulty input is the client-provided public key blob in the chat session initialization data.","triggerScenarios":"Thrown at crates/pumpkin/src/net/java/play/mod.rs:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Kick the player with a session-invalid reason","Verify key signature against Mojang's public key at session start","Log the failure for diagnostics"],"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-16T04:17:20.429Z"}