Pumpkin-MC/Pumpkin · error · PluginInitError

Calling `init_plugin` failed

Error message

Calling `init_plugin` failed: {0}

What it means

`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.

Solutions

  1. Read the wrapped wasmtime trap message and backtrace in the server log for the plugin-side cause
  2. Fix the plugin's init_plugin logic (bad assumptions, panics, unwraps)
  3. Update the plugin to match the server's plugin API version
  4. Temporarily disable the plugin to confirm it is the source
Defensive patterns

Strategy: try-catch

Type guard

fn init_failure(e: &PluginError) -> Option<&wasmtime::Error> { if let PluginError::CallInitPluginFailed(e) = e { Some(e) } else { None } }

Try / catch

if let Err(PluginError::CallInitPluginFailed(e)) = result { log::error!("plugin init trapped: {e:?}"); disable_plugin(plugin_id); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/f3e4e12084e2f107. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs:39

#[derive(Error, Debug)]
pub enum PluginInitError {
    #[error("Engine creation failed: {0}")]
    EngineCreationFailed(wasmtime::Error),
    #[error("Failed to setup linker: {0}")]
    LinkerSetupFailed(wasmtime::Error),
    #[error("Plugin is built against a different API version: {0}")]
    ApiVersionMismatch(wasmtime::Error),
    #[error("Failed to read plugin file: {0}")]
    FileReadFailed(std::io::Error),
    #[error("Failed to load plugin as component: {0}")]
    ComponentNewFailed(wasmtime::Error),
    #[error("Failed to create cache data for plugin: {0}")]
    ComponentCacheSerializeFailed(wasmtime::Error),
    #[error("Failed to write cache file for plugin: {0}")]
    ComponentCacheWriteFailed(std::io::Error),
    #[error("Failed to instantiate plugin: {0}")]
    InstantiationFailed(wasmtime::Error),
    #[error("Calling `init_plugin` failed: {0}")]
    CallInitPluginFailed(wasmtime::Error),
    #[error("Calling `get_metadata` failed: {0}")]
    CallGetMetadataFailed(wasmtime::Error),
    #[error("Failed to get absolute path: {0}")]
    PathResolutionFailed(std::io::Error),
    #[error("Failed to create cache: {0}")]
    CacheCreationFailed(wasmtime::Error),
}

#[derive(Clone, Copy, Default)]
struct SocketPolicy {
    tcp_connect: bool,
    tcp_bind: bool,
    udp_send: bool,
    udp_receive: bool,
    udp_bind: bool,
    loopback_only: bool,
}

View on GitHub (pinned to 8d4639e25a)