Pumpkin-MC/Pumpkin · critical
Cannot construct BlockFertilizeEvent from WASM
Error message
Cannot construct BlockFertilizeEvent from WASM
What it means
A panic in `BlockFertilizeEvent`'s `from_wasm_event` implementation of the ToFromWasmEvent trait. The host-side event enum contains a BlockFertilizeEvent, which cannot be reconstructed from a WASM-side event representation, so the code intentionally panics — this direction of conversion is unsupported for this event.
Solutions
- Do not route BlockFertilizeEvent through from_wasm_event; use to_wasm_event only
- Handle the event natively instead of round-tripping it through WASM
- Report/implement from_wasm_event support if bidirectional conversion is needed
- Check plugin/server versions for an unsupported event-flow path
Defensive patterns
Strategy: type-guard
Validate before calling
// before conversion
fn convertible_from_wasm(ev: &Event) -> bool { !matches!(ev, Event::BlockFertilizeEvent(_)) } Type guard
fn is_block_fertilize(ev: &Event) -> bool { matches!(ev, Event::BlockFertilizeEvent(_)) } // handle natively, never via from_wasm_event Prevention
- Never round-trip BlockFertilizeEvent through the WASM bridge
- Route unsupported-direction events to native handlers only
- Add a debug assertion/tests covering each event's supported conversion direction
When it happens
Trigger: Host code calls from_wasm_event with Event::BlockFertilizeEvent, i.e. attempting to convert a WASM-originated BlockFertilizeEvent back into the native type for a plugin.
Common situations: Plugin infrastructure routing a fertilizer-use event through the WASM event bridge that only supports native->wasm for this event type; server/plugin version mismatch exercising an unsupported conversion path.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Cannot construct BlockMultiPlaceEvent from WASM
- unexpected event type
- failed to add player resource
- failed to add world resource
- unexpected event type
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/cc2f37515d83b3a1.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/events/block.rs:904
block_pos: to_wasm_block_position(self.block_pos),
target_world,
player,
changed_blocks,
cancelled: self.cancelled,
})
}
fn apply_wasm_event(&mut self, event: Event, state: &mut PluginHostState) {
cleanup_event(&event, state);
if let Event::BlockFertilizeEvent(data) = event {
self.cancelled = data.cancelled;
}
}
fn from_wasm_event(event: Event, _state: &mut PluginHostState) -> Self {
match event {
Event::BlockFertilizeEvent(_) => {
panic!("Cannot construct BlockFertilizeEvent from WASM")
}
_ => panic!("unexpected event type"),
}
}
}
impl ToFromWasmEvent for BlockMultiPlaceEvent {
fn to_wasm_event(&self, state: &mut PluginHostState) -> Event {
let player = state
.add_player(self.player.clone())
.expect("failed to add player resource");
let target_world = state
.add_world(self.world.clone())
.expect("failed to add world resource");
let placed_blocks = self
.placed_blocks
.iter()
.map(|(pos, id)| (to_wasm_block_position(*pos), id.as_u16()))View on GitHub (pinned to 8d4639e25a)