{"record":{"id":"f3e4e12084e2f107","repo":"Pumpkin-MC/Pumpkin","slug":"calling-init-plugin-failed-0","errorCode":null,"errorMessage":"Calling `init_plugin` failed: {0}","messagePattern":"Calling `init_plugin` failed: (.+?)","errorType":"exception","errorClass":"PluginInitError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs","lineNumber":39,"sourceCode":"#[derive(Error, Debug)]\npub enum PluginInitError {\n    #[error(\"Engine creation failed: {0}\")]\n    EngineCreationFailed(wasmtime::Error),\n    #[error(\"Failed to setup linker: {0}\")]\n    LinkerSetupFailed(wasmtime::Error),\n    #[error(\"Plugin is built against a different API version: {0}\")]\n    ApiVersionMismatch(wasmtime::Error),\n    #[error(\"Failed to read plugin file: {0}\")]\n    FileReadFailed(std::io::Error),\n    #[error(\"Failed to load plugin as component: {0}\")]\n    ComponentNewFailed(wasmtime::Error),\n    #[error(\"Failed to create cache data for plugin: {0}\")]\n    ComponentCacheSerializeFailed(wasmtime::Error),\n    #[error(\"Failed to write cache file for plugin: {0}\")]\n    ComponentCacheWriteFailed(std::io::Error),\n    #[error(\"Failed to instantiate plugin: {0}\")]\n    InstantiationFailed(wasmtime::Error),\n    #[error(\"Calling `init_plugin` failed: {0}\")]\n    CallInitPluginFailed(wasmtime::Error),\n    #[error(\"Calling `get_metadata` failed: {0}\")]\n    CallGetMetadataFailed(wasmtime::Error),\n    #[error(\"Failed to get absolute path: {0}\")]\n    PathResolutionFailed(std::io::Error),\n    #[error(\"Failed to create cache: {0}\")]\n    CacheCreationFailed(wasmtime::Error),\n}\n\n#[derive(Clone, Copy, Default)]\nstruct SocketPolicy {\n    tcp_connect: bool,\n    tcp_bind: bool,\n    udp_send: bool,\n    udp_receive: bool,\n    udp_bind: bool,\n    loopback_only: bool,\n}","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs#L21-L57","documentation":"`CallInitPluginFailed` wraps a wasmtime::Error produced when the host invokes the plugin's exported `init_plugin` function and the call traps (or the function returns an error). The component instantiated fine but its initialization entry point failed at runtime.","triggerScenarios":"Calling the plugin's `init_plugin` export during plugin load; the function traps (panics inside the wasm, unreachable, out of fuel/limits) or returns Result::Err.","commonSituations":"Plugin initialization code reads a bad config, panics on unexpected world state, or hits a host-function error during setup; plugin compiled for a mismatched API calling a host function that traps.","solutions":["Read the wrapped wasmtime trap message and backtrace in the server log for the plugin-side cause","Fix the plugin's init_plugin logic (bad assumptions, panics, unwraps)","Update the plugin to match the server's plugin API version","Temporarily disable the plugin to confirm it is the source"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn init_failure(e: &PluginError) -> Option<&wasmtime::Error> { if let PluginError::CallInitPluginFailed(e) = e { Some(e) } else { None } }","tryCatchPattern":"if let Err(PluginError::CallInitPluginFailed(e)) = result { log::error!(\"plugin init trapped: {e:?}\"); disable_plugin(plugin_id); }","preventionTips":["Make plugin init_plugin defensive: no unwraps, validate config first","Test plugin init against the target server version in CI","Log full wasmtime trap context in the plugin"],"tags":["wasm","wasmtime","plugin-loader","plugin-init"],"backgroundTag":"module-init-failed","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"}