Pumpkin-MC/Pumpkin · critical
unexpected event
Error message
unexpected event
What it means
A panic in EntityDeathEvent's data_from_event: the trait converts a generic Event enum into this event's typed Data, and any variant other than Event::EntityDeathEvent hits the catch-all `_ => panic!("unexpected event")`. This is an internal invariant violation by the event dispatcher.
Solutions
- Verify the dispatcher sends Event::EntityDeathEvent to handlers registered for EventType::EntityDeathEvent
- Check pumpkin-plugin-api version alignment between the dispatcher and plugin
- Report/fix the routing code; replace panic with a logged error in downstream forks
Example fix
// before
_ => panic!("unexpected event"),
// after
other => {
log::error!("EntityDeathEvent handler received {:?}", other);
EntityDeathEventData::default()
} Defensive patterns
Strategy: type-guard
Validate before calling
fn is_entity_death(event: &Event) -> bool { matches!(event, Event::EntityDeathEvent(_)) } Type guard
fn as_entity_death(event: Event) -> Option<EntityDeathEventData> { match event { Event::EntityDeathEvent(d) => Some(d), _ => None } } Try / catch
std::panic::catch_unwind(|| dispatch(event)).unwrap_or_else(|_| log_dispatch_bug_and_skip())
Prevention
- Register handlers with the exact EventType they implement
- Keep pumpkin-plugin-api versions in sync across dispatcher and plugins
- Replace panics with logged errors when forking event conversion code
When it happens
Trigger: The event bus dispatches an Event whose variant does not match EVENT_TYPE to EntityDeathEvent's data_from_event.
Common situations: A plugin/event-dispatcher bug routing events by the wrong EventType, or a mismatch between registered handler type and the emitted event variant after an API version change.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/995e7fd121e1be55.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-plugin-api/src/events/entity/entity_death.rs:16
use crate::wit::pumpkin::plugin::event::{
EntityDeathEventData, Event, EventType, PlayerDeathEventData,
};
use super::super::FromIntoEvent;
/// Event triggered when an entity dies.
pub struct EntityDeathEvent;
impl FromIntoEvent for EntityDeathEvent {
const EVENT_TYPE: EventType = EventType::EntityDeathEvent;
type Data = EntityDeathEventData;
fn data_from_event(event: Event) -> Self::Data {
match event {
Event::EntityDeathEvent(data) => data,
_ => panic!("unexpected event"),
}
}
fn data_into_event(data: Self::Data) -> Event {
Event::EntityDeathEvent(data)
}
}
/// Event triggered when a player dies.
pub struct PlayerDeathEvent;
impl FromIntoEvent for PlayerDeathEvent {
const EVENT_TYPE: EventType = EventType::PlayerDeathEvent;
type Data = PlayerDeathEventData;
fn data_from_event(event: Event) -> Self::Data {
match event {
Event::PlayerDeathEvent(data) => data,
_ => panic!("unexpected event"),View on GitHub (pinned to 8d4639e25a)