Pumpkin-MC/Pumpkin · error
unexpected event
Error message
unexpected event
What it means
This panic fires in `data_from_event`, the `Event` trait implementation for `BrewingStandFuelEvent`. It only accepts `Event::BrewingStandFuelEvent(data)`; any other `Event` variant means the dispatcher delivered a mismatched payload. The library treats that as an invariant violation and panics with "unexpected event".
Solutions
- Register the handler for `EventType::BrewingStandFuelEvent` and confirm the dispatcher keys off that type.
- Construct events through `BrewingStandFuelEvent::data_into_event` when calling manually.
- Align API versions across server and plugin; clean rebuild to eliminate variant mismatch.
- Narrow first: `if let Event::BrewingStandFuelEvent(data) = event { ... }`.
- Replace the panic with a logged error or typed `Result` for graceful failure.
Example fix
// before
match event {
Event::BrewingStandFuelEvent(data) => data,
_ => panic!("unexpected event"),
}
// after
match event {
Event::BrewingStandFuelEvent(data) => data,
_ => return None,
} Defensive patterns
Strategy: type-guard
Validate before calling
// Before dispatch assert_eq!(event.event_type(), EventType::BrewingStandFuelEvent, "wrong event routed to BrewingStandFuel handler");
Type guard
fn as_brewing_stand_fuel(event: &Event) -> Option<&BrewingStandFuelEventData> {
match event {
Event::BrewingStandFuelEvent(data) => Some(data),
_ => None,
}
} Try / catch
let result = std::panic::catch_unwind(AssertUnwindSafe(|| handler.data_from_event(event)));
if result.is_err() {
log::error!("BrewingStandFuelEvent handler received an unexpected event variant");
} Prevention
- Register the handler under EventType::BrewingStandFuelEvent only.
- Narrow the event with if-let/matches! before manual extraction.
- Construct events via BrewingStandFuelEvent::data_into_event.
- Keep API versions aligned between server and plugin.
- Verify EventType constants in registration code — nearby names like BrewEvent are easy to mistype.
When it happens
Trigger: Calling `data_from_event` with an `Event` that is not `Event::BrewingStandFuelEvent`, such as a brewing/furnace event routed to this handler or an incorrect `EventType` registration.
Common situations: Handler registered under the wrong `EventType` in a config/registration table, custom event routing code, or `Event` enum drift after upgrading pumpkin-plugin-api so previously matched routes now fall to the `_` arm.
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/c4c866ad43012253.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-plugin-api/src/events/inventory/brewing_stand_fuel.rs:13
use super::super::FromIntoEvent;
use crate::wit::pumpkin::plugin::event::{BrewingStandFuelEventData, Event, EventType};
/// Event triggered when brewing stand fuel is consumed or refilled.
pub struct BrewingStandFuelEvent;
impl FromIntoEvent for BrewingStandFuelEvent {
const EVENT_TYPE: EventType = EventType::BrewingStandFuelEvent;
type Data = BrewingStandFuelEventData;
fn data_from_event(event: Event) -> Self::Data {
match event {
Event::BrewingStandFuelEvent(data) => data,
_ => panic!("unexpected event"),
}
}
fn data_into_event(data: Self::Data) -> Event {
Event::BrewingStandFuelEvent(data)
}
}
View on GitHub (pinned to 8d4639e25a)