{"record":{"id":"3f8146c245771e20","repo":"Pumpkin-MC/Pumpkin","slug":"plugin-is-built-against-a-different-api-version","errorCode":null,"errorMessage":"Plugin is built against a different API version: {0}","messagePattern":"Plugin is built against a different API version: (.+?)","errorType":"exception","errorClass":"PluginInitError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs","lineNumber":27,"sourceCode":"    Context, PluginMetadata, cache::calculate_hash_for_bytes,\n    loader::wasm::wasm_host::state::PluginHostState, permissions,\n};\nuse pumpkin_plugin_runtime::RuntimeSpawner;\n\npub mod args;\npub mod concurrent_store;\npub mod logging;\npub mod signature;\npub mod state;\npub 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}\")]","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs#L9-L45","documentation":"This is `PluginInitError::ApiVersionMismatch`, wrapping a `wasmtime::Error`. During plugin loading, Pumpkin calls a guest export to read the plugin's API version and that call failed, so the plugin is assumed to be built against a different API and is rejected. Unlike the loader-level version errors, this one fires when the version check itself faults at the WASM boundary.","triggerScenarios":"Invoking the plugin's version/instance export via wasmtime during load and the trap/error indicates a foreign or incompatible component (missing export, wrong signature, version check trap).","commonSituations":"Loading a core-module (not a component) .wasm file, a plugin compiled for a different WIT world, or a plugin whose version export traps.","solutions":["Rebuild the plugin against the current Pumpkin API and WIT world","Confirm the file is a WASM component built with wasm32-wasip2, not a bare module","Check the wrapped wasmtime::Error for the exact trap/missing export","Use a plugin build matching your server release"],"exampleFix":"// before: cargo build --target wasm32-wasi\n// after:  cargo build --target wasm32-wasip2 # produce a proper component","handlingStrategy":"validation","validationCode":"// pre-validate the artifact is a component for this API\nif !wasm_tools::is_component(&bytes) { return Err(\"plugin must be a wasm32-wasip2 component\"); }","typeGuard":"fn is_valid_plugin_component(bytes: &[u8]) -> bool { bytes.starts_with(&[0x0d, 0x00, 0x01, 0x00]) /* component preamble */ }","tryCatchPattern":"match init.load_component(&bytes) {\n    Err(PluginInitError::ApiVersionMismatch(e)) => eprintln!(\"plugin built against a different API: {e} — rebuild\"),\n    other => other,\n}","preventionTips":["Build plugins with the matching pumpkin-plugin SDK and WIT world","Ship plugins as wasm32-wasip2 components only","Verify plugin artifacts with wasm-tools before distribution"],"tags":["wasmtime","api-version","wasm","plugin"],"backgroundTag":"incompatible-source-type","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}