Pumpkin-MC/Pumpkin · warning · PluginInitError

Failed to create cache data for plugin

Error message

Failed to create cache data for plugin: {0}

What it means

This is `PluginInitError::ComponentCacheSerializeFailed`, wrapping a `wasmtime::Error`. Pumpkin precompiles plugin components to a on-disk cache; serializing the compiled artifact (`Component::serialize`) failed. This is a cache-optimization failure, not a plugin-correctness problem.

Solutions

  1. Delete the plugin cache directory and let the server rebuild it
  2. Ensure the server was fully rebuilt after a wasmtime version bump (mixed artifacts)
  3. Disable wasmtime caching/serialization in config if not needed — plugins will still load via normal compilation
  4. Report/inspect the wrapped wasmtime::Error if serialization is consistently unsupported

Example fix

// before: cache/teleport.cwasm (stale, old wasmtime)
// after:  rm -rf cache/*.cwasm && restart server
Defensive patterns

Strategy: fallback

Try / catch

match component.serialize() {
    Err(PluginInitError::ComponentCacheSerializeFailed(e)) => {
        warn!("cache serialization failed ({e}); falling back to normal compilation");
        // continue loading the component without the cache
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling `Component::serialize` on the compiled component fails — typically version incompatibility between the wasmtime that produced the artifact and the serializer, or unsupported caching configuration.

Common situations: Stale cache format after a server/wasmtime upgrade, exotic wasmtime feature flags whose artifacts can't be serialized, disk or memory errors during serialization.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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

Appendix: source

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

pub mod concurrent_store;
pub mod logging;
pub mod signature;
pub mod state;
pub mod wit;

#[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,

View on GitHub (pinned to 8d4639e25a)