{"record":{"id":"85cd7963a7c494c5","repo":"Pumpkin-MC/Pumpkin","slug":"modifying-packets-from-wasm-is-not-yet-supported","errorCode":null,"errorMessage":"Modifying packets from WASM is not yet supported.","messagePattern":"Modifying packets from WASM is not yet supported\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/events/server.rs","lineNumber":121,"sourceCode":"            player: player_res,\n            packet,\n            packet_id: self.packet_id,\n            raw_payload: self.payload.iter().copied().collect(),\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::PacketSentEvent(data) = event {\n            self.payload = data.raw_payload.into();\n            self.cancelled = data.cancelled;\n        }\n    }\n    fn from_wasm_event(event: Event, _state: &mut PluginHostState) -> Self {\n        match event {\n            Event::PacketSentEvent(_) => {\n                panic!(\"Modifying packets from WASM is not yet supported.\");\n            }\n            _ => panic!(\"unexpected event type\"),\n        }\n    }\n}\n\nimpl ToFromWasmEvent for ServerCommandEvent {\n    fn to_wasm_event(&self, _state: &mut PluginHostState) -> Event {\n        Event::ServerCommandEvent(ServerCommandEventData {\n            command: self.command.clone(),\n            cancelled: self.cancelled,\n        })\n    }\n\n    fn from_wasm_event(event: Event, _state: &mut PluginHostState) -> Self {\n        match event {\n            Event::ServerCommandEvent(data) => Self {\n                command: data.command,","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/events/server.rs#L103-L139","documentation":"PacketSentEvent::from_wasm_event intentionally panics for Event::PacketSentEvent: converting a plugin-returned packet-sent event back to the host representation is not implemented. WASM plugins may only cancel these events, not modify the packet. Reaching this arm means the host tried to apply plugin-side modifications.","triggerScenarios":"The host calls from_wasm_event on a PacketSentEvent returned by a plugin — i.e. any pipeline step that attempts to convert the full WIT packet event back instead of just reading the cancelled flag.","commonSituations":"Host or plugin code tries to mutate outbound packets from WASM; developer extended the event pipeline to support modification before implementing the converter.","solutions":["Only read the cancelled flag from the plugin's returned event; do not call from_wasm_event on packet events.","Implement the missing WIT-to-raw conversion in server.rs if packet modification support is required.","Restrict plugin handlers to cancel-only semantics for PacketSentEvent until support exists.","Follow upstream Pumpkin development for WASM packet modification support."],"exampleFix":"// before\nlet converted = PacketSentEvent::from_wasm_event(wasm_event, state);\n// after\nlet cancelled = match wasm_event {\n    Event::PacketSentEvent(d) => d.cancelled,\n    _ => false,\n}; // cancel-only","handlingStrategy":"fallback","validationCode":"// only convert when you just need the cancel flag\nif !matches!(wasm_event, Event::PacketSentEvent(_)) { skip(); }","typeGuard":"fn packet_sent_cancel_flag(e: &Event) -> Option<bool> {\n    match e { Event::PacketSentEvent(d) => Some(d.cancelled), _ => None }\n}","tryCatchPattern":"let cancelled = catch_unwind(|| PacketSentEvent::from_wasm_event(event, state))\n    .ok()\n    .map(|e| e.cancelled)\n    .unwrap_or(false);","preventionTips":["Consume only the cancelled flag from plugin packet-sent events","Implement the missing WIT-to-raw conversion before enabling mutation","Document cancel-only semantics for plugin authors","Follow upstream Pumpkin for packet modification support"],"tags":["wasm","plugin","unsupported-operation","packets"],"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"}