{"record":{"id":"6b2bf6e05f048a06","repo":"Pumpkin-MC/Pumpkin","slug":"failed-to-add-world-resource","errorCode":null,"errorMessage":"failed to add world resource","messagePattern":"failed to add world resource","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/events/block.rs","lineNumber":918,"sourceCode":"\n    fn from_wasm_event(event: Event, _state: &mut PluginHostState) -> Self {\n        match event {\n            Event::BlockFertilizeEvent(_) => {\n                panic!(\"Cannot construct BlockFertilizeEvent from WASM\")\n            }\n            _ => panic!(\"unexpected event type\"),\n        }\n    }\n}\n\nimpl ToFromWasmEvent for BlockMultiPlaceEvent {\n    fn to_wasm_event(&self, state: &mut PluginHostState) -> Event {\n        let player = state\n            .add_player(self.player.clone())\n            .expect(\"failed to add player resource\");\n        let target_world = state\n            .add_world(self.world.clone())\n            .expect(\"failed to add world resource\");\n        let placed_blocks = self\n            .placed_blocks\n            .iter()\n            .map(|(pos, id)| (to_wasm_block_position(*pos), id.as_u16()))\n            .collect();\n        Event::BlockMultiPlaceEvent(BlockMultiPlaceEventData {\n            player,\n            target_world,\n            placed_blocks,\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::BlockMultiPlaceEvent(data) = event {\n            self.cancelled = data.cancelled;\n        }","sourceCodeStart":900,"sourceCodeEnd":936,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/events/block.rs#L900-L936","documentation":"An `.expect(\"failed to add world resource\")` in BlockMultiPlaceEvent::to_wasm_event. The event's world Arc must be registered as a WASM resource in PluginHostState; add_world failed, so conversion to the WASM event panics.","triggerScenarios":"Serializing a BlockMultiPlaceEvent for WASM plugins when the world reference cannot be added to the host resource table.","commonSituations":"Event fired while its world is being unloaded/removed; resource-table state corruption in the WASM host; version-skew between event producers and the wasm host.","solutions":["Check that the world is still loaded when the event is dispatched","Inspect PluginHostState::add_world for the insertion failure cause","Skip WASM dispatch of events tied to unloading worlds","Update to a server version fixing the host-state handling"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// guard before dispatching to WASM\nif !world.is_loaded() || world.is_unloading() { skip_wasm_dispatch(event); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Suppress WASM event dispatch for worlds being unloaded","Handle add_world failures gracefully in host state code","Cover world-unload-during-event scenarios in tests"],"tags":["panic","wasm","resource-table","events","world"],"backgroundTag":"internal-invariant-violation","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"}