Pumpkin-MC/Pumpkin · error · PluginInitError

Failed to create cache

Error message

Failed to create cache: {0}

What it means

`CacheCreationFailed` wraps a wasmtime::Error from creating the wasmtime compilation cache used to speed up plugin loading. Wasmtime could not initialize its cache (config or cache directory problem).

Solutions

  1. Ensure the wasmtime cache directory exists and is writable by the server process
  2. Fix or remove the cache config so wasmtime runs without a cache
  3. Check disk space and mount permissions
  4. Point the cache dir to a writable location via env/config
Defensive patterns

Strategy: fallback

Validate before calling

let cache_dir = std::path::Path::new(&cache_path); if !cache_dir.is_dir() { std::fs::create_dir_all(cache_dir)?; } // verify write: std::fs::write(cache_dir.join(".t"), b"")?

Prevention

When it happens

Trigger: Configuring the wasmtime Engine with a cache config that points to an unwritable/nonexistent directory, or an invalid cache config setting.

Common situations: Read-only or missing cache directory (e.g. in containers or restricted $HOME); invalid cache config file; disk full.

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/07fee0a4efd4a4dc. Report an issue: GitHub.

Appendix: source

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

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

impl SocketPolicy {
    const fn allows(self, addr: SocketAddr, reason: SocketAddrUse) -> bool {
        // Wasmtime performs a wildcard bind before an outbound connect/send.
        // Permit only that precursor here; the later destination check still
        // enforces the actual protocol and loopback policy.

View on GitHub (pinned to 8d4639e25a)