{"record":{"id":"ca6cd7615b8fea2b","repo":"Pumpkin-MC/Pumpkin","slug":"failed-to-read-plugin-file-0","errorCode":null,"errorMessage":"Failed to read plugin file: {0}","messagePattern":"Failed to read plugin file: (.+?)","errorType":"exception","errorClass":"PluginInitError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs","lineNumber":29,"sourceCode":"};\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}\")]\n    CacheCreationFailed(wasmtime::Error),\n}","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/plugin/loader/wasm/wasm_host/mod.rs#L11-L47","documentation":"This is `PluginInitError::FileReadFailed`, wrapping `std::io::Error`. The loader could not read the plugin file from disk before handing it to wasmtime. The OS-level cause (not found, permission denied, is-a-directory) is in the wrapped io::Error.","triggerScenarios":"`std::fs::read` (or similar) on the plugin path during WASM plugin load fails — path doesn't exist, no read permission, or path points at a directory.","commonSituations":"Typo in plugin name in the plugins directory, file deleted while server ran, wrong permissions after extracting an archive as root, config pointing at the wrong folder.","solutions":["Verify the .wasm file exists at the configured plugins path (ls the directory)","Fix file permissions (chmod/chown) so the server user can read it","Correct the plugin path/filename in your server config or plugin directory","Re-download/rebuild the plugin if the file is truncated or empty"],"exampleFix":"// before\nlet bytes = std::fs::read(\"plugins/teleport.wasm\")?;\n// after: check first\nif !path.exists() { eprintln!(\"plugin missing: {}\", path.display()); }\nlet bytes = std::fs::read(&path)?;","handlingStrategy":"validation","validationCode":"let path = Path::new(plugin_path);\nif !path.is_file() { bail!(\"plugin file not found: {}\", plugin_path); }\nlet meta = std::fs::metadata(path)?;\nif meta.permissions().mode() & 0o400 == 0 { bail!(\"plugin file not readable\"); }","typeGuard":"fn readable_plugin(path: &Path) -> bool { path.is_file() && File::open(path).is_ok() }","tryCatchPattern":"match init::read_plugin_file(path) {\n    Err(PluginInitError::FileReadFailed(e)) => eprintln!(\"cannot read plugin {}: {e}\", path.display()),\n    other => other,\n}","preventionTips":["Verify plugin filenames and paths after deployment","Run the server as a user with read access to the plugins directory","Compare checksums after transferring plugin files"],"tags":["io","file","plugin","wasm"],"backgroundTag":"file-read-failed","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}