Pumpkin-MC/Pumpkin · error
Modifying packets from WASM is not yet supported in this…
Error message
Modifying packets from WASM is not yet supported in this simple implementation.
What it means
PacketReceivedEvent::from_wasm_event intentionally panics: converting a WIT packet event back into the raw host event is not implemented, because WASM plugins may only cancel packets, not modify them. Reaching this arm means the host tried to apply a modified event returned by a plugin, which this simple implementation does not support.
Solutions
- Only read the cancelled flag from the plugin's returned event; never convert the full packet back via from_wasm_event.
- If packet modification is needed, implement the WIT-variant-to-raw conversion marked by the TODO in server.rs.
- Keep plugin handlers to cancel-only semantics for packet events until upstream support lands.
- Track upstream Pumpkin work adding packet modification support for WASM plugins.
Example fix
// before
let converted = PacketReceivedEvent::from_wasm_event(wasm_event, state);
// after
let cancelled = match wasm_event {
Event::PacketReceivedEvent(d) => d.cancelled,
_ => false,
}; // only consume the cancel flag Defensive patterns
Strategy: fallback
Validate before calling
// only convert when you just need the cancel flag
if !matches!(wasm_event, Event::PacketReceivedEvent(_)) { skip(); } Type guard
fn packet_event_is_cancel_only(e: &Event) -> Option<bool> {
match e { Event::PacketReceivedEvent(d) => Some(d.cancelled), _ => None }
} Try / catch
let cancelled = catch_unwind(|| PacketReceivedEvent::from_wasm_event(event, state))
.ok()
.map(|e| e.cancelled)
.unwrap_or(false); Prevention
- Treat WASM packet events as cancel-only; never read back packet data
- Implement the TODO conversion in server.rs before enabling modification
- Gate any packet-mutation feature behind a supported converter
- Track upstream Pumpkin support for WASM packet modification
When it happens
Trigger: A WASM plugin receives a PacketReceivedEvent and the host attempts to call from_wasm_event to convert the (possibly modified) event back — i.e. any code path that reads back packet contents from the plugin rather than only its cancelled flag.
Common situations: Plugin API or host code attempts to apply plugin-side packet modifications; a developer extended the event pipeline to support mutation before the converter was implemented.
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
- Modifying packets from WASM is not yet supported.
- Plugin was built for an incompatible API version. Please…
- Plugin API version mismatch
- Wasm plugin initialization error
- Plugin is built against a different API version
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/48a3771633b8fe50.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/events/server.rs:76
raw_payload: self.payload.to_vec(),
cancelled: self.cancelled,
})
}
fn apply_wasm_event(&mut self, event: Event, state: &mut PluginHostState) {
cleanup_event(&event, state);
if let Event::PacketReceivedEvent(data) = event {
self.packet_id = data.packet_id;
self.payload = data.raw_payload.into();
self.cancelled = data.cancelled;
}
}
fn from_wasm_event(event: Event, _state: &mut PluginHostState) -> Self {
match event {
Event::PacketReceivedEvent(_) => {
// TODO: Implement converting from WIT variant back to raw if needed.
// For now, we only support cancellation.
panic!(
"Modifying packets from WASM is not yet supported in this simple implementation."
);
}
_ => panic!("unexpected event type"),
}
}
}
impl ToFromWasmEvent for PacketSentEvent {
fn to_wasm_event(&self, state: &mut PluginHostState) -> Event {
let player_res = state
.add_player(self.player.clone())
.expect("failed to add player resource");
let packet = match self.player.client.as_ref() {
ClientPlatform::Java(_) => {
generated_packets::clientbound_java_any_to_wit(self.packet.as_ref())
.map_or(ClientboundPacket::Unknown, ClientboundPacket::Java)View on GitHub (pinned to 8d4639e25a)