{"record":{"id":"44167e4a4add2b12","repo":"Pumpkin-MC/Pumpkin","slug":"failed-to-instantiate-plugin-0","errorCode":null,"errorMessage":"Failed to instantiate plugin: {0}","messagePattern":"Failed to instantiate plugin: (.+?)","errorType":"exception","errorClass":"PluginInitError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs","lineNumber":37,"sourceCode":"pub mod wit;\n\n#[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,","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs#L19-L55","documentation":"This thiserror variant `InstantiationFailed` wraps a wasmtime::Error raised while instantiating a WASM plugin component in the Pumpkin plugin loader. Wasmtime failed to create a running instance of the compiled component (linking imports, memory, or start execution). The plugin file itself loaded but could not be turned into a live instance.","triggerScenarios":"Loading a .wasm plugin whose component imports functions/types the host does not provide (mismatched WIT world version), or a component with a failing start/instantiation section.","commonSituations":"Plugin built against a different pumpkin-plugin API version than the server; missing host exports after a server update; corrupted or partially downloaded wasm file.","solutions":["Rebuild the plugin against the same WIT world / pumpkin-api version as the server","Check that the wasmtime runtime version on the server matches the one the plugin was compiled with","Validate the component with `wasmtime compile` or `wasm-tools validate` before deploying","Read the wrapped wasmtime::Error in the log for the exact missing import"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before loading\nif !std::path::Path::new(&plugin_path).exists() { return Err(\"plugin file missing\"); }\n// optionally: wasm-tools validate plugin.wasm","typeGuard":"fn is_wasmtime_error(e: &PluginError) -> Option<&wasmtime::Error> { if let PluginError::InstantiationFailed(e) = e { Some(e) } else { None } }","tryCatchPattern":"match loader.load(path) { Err(PluginError::InstantiationFailed(e)) => { log::error!(\"plugin instantiation failed: {e}\"); /* skip plugin */ }, r => r? }","preventionTips":["Build plugins against the exact server WIT world version","Validate components with wasm-tools before deploying","Keep server and plugin wasmtime/target versions in sync"],"tags":["wasm","wasmtime","plugin-loader","instantiation"],"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"}