Pumpkin-MC/Pumpkin · warning · PluginInitError
Failed to write cache file for plugin
Error message
Failed to write cache file for plugin: {0} What it means
This is `PluginInitError::ComponentCacheWriteFailed`, wrapping `std::io::Error`. The serialized compiled component was produced but writing it to the cache file on disk failed. The plugin may still load, but caching is broken and startup will recompile every time.
Solutions
- Ensure the cache/plugins directory exists and is writable by the server user (mkdir + chown/chmod)
- Free disk space if the disk is full
- Fix container/volume mounts so the data dir is not read-only
- If writes can't be enabled, run without the cache (accept recompilation cost)
Example fix
# before: PermissionDenied on ./cache mkdir -p cache && chown -R minecraft:minecraft cache # or in Docker: drop :ro from the volume mount
Defensive patterns
Strategy: fallback
Validate before calling
let dir = Path::new(cache_dir);
if !dir.exists() { std::fs::create_dir_all(dir)?; }
let probe = dir.join(".write-probe");
std::fs::write(&probe, b"ok").map_err(|e| format!("cache dir not writable: {e}"))?;
let _ = std::fs::remove_file(&probe); Type guard
fn cache_writable(dir: &Path) -> bool { dir.is_dir() && std::fs::write(dir.join(".probe"), b"").is_ok() } Try / catch
match init::write_cache(&artifact, cache_path) {
Err(PluginInitError::ComponentCacheWriteFailed(e)) => {
warn!("cannot write plugin cache {}: {e}; continuing without cache", cache_path.display());
}
other => other,
} Prevention
- Ensure the server's data directory is writable by its runtime user
- Avoid read-only volume mounts for server data dirs
- Monitor disk space on the host
When it happens
Trigger: `std::fs::write` of the `.cwasm` cache artifact fails — read-only filesystem, missing cache directory, disk full, or permission denied on the cache path.
Common situations: Server running under a user without write access to its data directory, Docker volume mounted read-only, full disk, cache dir deleted while server running.
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
- Failed to read plugin file
- Failed to create cache data for plugin
- Unknown Status Code
- Failed to load library
- Missing plugin metadata
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/c25d319c88a2740d.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs:35
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,
tcp_bind: bool,
udp_send: bool,View on GitHub (pinned to 8d4639e25a)