Pumpkin-MC/Pumpkin · critical

Cannot construct BlockMultiPlaceEvent from WASM

Error message

Cannot construct BlockMultiPlaceEvent from WASM

What it means

A panic in `BlockMultiPlaceEvent`'s from_wasm_event: reconstructing this native event from the WASM Event enum is intentionally unsupported, mirroring BlockFertilizeEvent. Any attempt to convert a WASM-side BlockMultiPlaceEvent back to native panics.

Solutions

  1. Treat BlockMultiPlaceEvent as native-to-WASM only; never reconstruct it from WASM
  2. Handle such events natively at the source instead of through the bridge
  3. Implement from_wasm_event support if bidirectional flow is required
  4. Confirm event dispatch tables don't route this event through from_wasm_event
Defensive patterns

Strategy: type-guard

Validate before calling

// before conversion
fn convertible_from_wasm(ev: &Event) -> bool { !matches!(ev, Event::BlockMultiPlaceEvent(_)) }

Type guard

fn is_block_multi_place(ev: &Event) -> bool { matches!(ev, Event::BlockMultiPlaceEvent(_)) } // handle natively, never via from_wasm_event

Prevention

When it happens

Trigger: Calling from_wasm_event with Event::BlockMultiPlaceEvent, i.e. requesting native reconstruction of a WASM-originated multi-place event.

Common situations: Plugin/bridge code attempting a round-trip conversion the trait does not support; dispatch table routing this event down an unsupported path; version mismatch in generated bindings.

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


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/0c9d85fca8c46ee4. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/events/block.rs:942

        Event::BlockMultiPlaceEvent(BlockMultiPlaceEventData {
            player,
            target_world,
            placed_blocks,
            cancelled: self.cancelled,
        })
    }

    fn apply_wasm_event(&mut self, event: Event, state: &mut PluginHostState) {
        cleanup_event(&event, state);
        if let Event::BlockMultiPlaceEvent(data) = event {
            self.cancelled = data.cancelled;
        }
    }

    fn from_wasm_event(event: Event, _state: &mut PluginHostState) -> Self {
        match event {
            Event::BlockMultiPlaceEvent(_) => {
                panic!("Cannot construct BlockMultiPlaceEvent from WASM")
            }
            _ => panic!("unexpected event type"),
        }
    }
}

impl ToFromWasmEvent for BlockReceiveGameEvent {
    fn to_wasm_event(&self, state: &mut PluginHostState) -> Event {
        let target_world = state
            .add_world(self.world.clone())
            .expect("failed to add world resource");
        Event::BlockReceiveGameEvent(BlockReceiveGameEventData {
            block_pos: to_wasm_block_position(self.block_pos),
            target_world,
            game_event: self.game_event.clone(),
            source_entity_id: self
                .source_entity
                .as_ref()

View on GitHub (pinned to 8d4639e25a)