{"record":{"id":"a0b3f361b156beba","repo":"Pumpkin-MC/Pumpkin","slug":"cannot-construct-entityblockformevent-from-wasm","errorCode":null,"errorMessage":"Cannot construct EntityBlockFormEvent from WASM","messagePattern":"Cannot construct EntityBlockFormEvent from WASM","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/events/block.rs","lineNumber":1211,"sourceCode":"            block_pos: to_wasm_block_position(self.block_pos),\n            target_world,\n            new_state_id: self.new_state_id.as_u16(),\n            cancelled: self.cancelled,\n        })\n    }\n\n    fn apply_wasm_event(&mut self, event: Event, state: &mut PluginHostState) {\n        cleanup_event(&event, state);\n        if let Event::EntityBlockFormEvent(data) = event {\n            self.new_state_id = BlockStateId::new_or_air(data.new_state_id);\n            self.cancelled = data.cancelled;\n        }\n    }\n\n    fn from_wasm_event(event: Event, _state: &mut PluginHostState) -> Self {\n        match event {\n            Event::EntityBlockFormEvent(_) => {\n                panic!(\"Cannot construct EntityBlockFormEvent from WASM\")\n            }\n            _ => panic!(\"unexpected event type\"),\n        }\n    }\n}\n\nimpl ToFromWasmEvent for FluidLevelChangeEvent {\n    fn to_wasm_event(&self, state: &mut PluginHostState) -> Event {\n        let target_world = state\n            .add_world(self.world.clone())\n            .expect(\"failed to add world resource\");\n        Event::FluidLevelChangeEvent(FluidLevelChangeEventData {\n            block_pos: to_wasm_block_position(self.block_pos),\n            target_world,\n            new_state_id: self.new_state_id.as_u16(),\n            cancelled: self.cancelled,\n        })\n    }","sourceCodeStart":1193,"sourceCodeEnd":1229,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/events/block.rs#L1193-L1229","documentation":"`from_wasm_event` for EntityBlockFormEvent panics if it is handed an Event::EntityBlockFormEvent. The event only flows host->plugin; returning it from a plugin to the host is deliberately unsupported, so this arm is a guard panic.","triggerScenarios":"A plugin returns Event::EntityBlockFormEvent from a handler, and the host's from_wasm_event conversion is invoked with it.","commonSituations":"Plugin code echoing back the event object; SDK bindings generating a wrong return type for the block-form event handler; hand-written bindings in another plugin language.","solutions":["Change the plugin to not return the EntityBlockFormEvent it received.","Regenerate plugin bindings with the correct SDK so the handler returns the expected type.","Use the event's mutation/cancellation API instead of returning the event.","Align host and plugin WIT versions."],"exampleFix":"// plugin side, before\nfn on_block_form(e: EntityBlockFormEvent) -> Event { Event::EntityBlockFormEvent(e) }\n// after\nfn on_block_form(e: EntityBlockFormEvent) -> Event { e.set_cancelled(false); /* no re-emit */ }\n","handlingStrategy":"validation","validationCode":"// plugin side: assert handler never returns block-form events\nassert!(!matches!(ret, Some(Event::EntityBlockFormEvent(_))));","typeGuard":"fn is_entity_block_form(e: &Event) -> bool { matches!(e, Event::EntityBlockFormEvent(_)) }","tryCatchPattern":null,"preventionTips":["Consume host events; do not echo them back.","Regenerate bindings after WIT changes.","Test handlers with ABI-compatibility integration tests."],"tags":["wasm","plugin-host","panic","event-direction"],"backgroundTag":"unsupported-operation","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"}