{"record":{"id":"56d05b7a081c30e6","repo":"swc-project/swc","slug":"filesystem-cache-is-not-enabled-cannot-read-plugi","errorCode":null,"errorMessage":"Filesystem cache is not enabled, cannot read plugin from phsyical path","messagePattern":"Filesystem cache is not enabled, cannot read plugin from phsyical path","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/swc_plugin_runner/src/cache.rs","lineNumber":144,"sourceCode":"                        fs_cache_store.store(rt, &module_bytes_hash, &cache)?;\n                        cache\n                    };\n\n                // Store hash to load from fs_cache_store later.\n                self.fs_cache_hash_store\n                    .insert(key.to_string(), module_bytes_hash);\n\n                // Also store in memory for the in-process cache.\n                self.insert_compiled_module_bytes(key.to_string(), module);\n            }\n\n            // Store raw bytes into memory cache.\n            self.insert_raw_bytes(key.to_string(), raw_module_bytes);\n\n            return Ok(());\n        }\n\n        anyhow::bail!(\"Filesystem cache is not enabled, cannot read plugin from phsyical path\");\n    }\n\n    /// Returns a PluingModuleBytes can be compiled into a wasmer::Module.\n    /// Depends on the cache availability, it may return a raw bytes or a\n    /// serialized bytes.\n    pub fn get(&self, rt: &dyn runtime::Runtime, key: &str) -> Option<Box<dyn PluginModuleBytes>> {\n        // Look for compiled module bytes first, it is the cheapest way to get compile\n        // wasmer::Module.\n        if let Some(compiled_module) = self.compiled_module_bytes.get(key) {\n            let cache = rt.clone_cache(compiled_module)?;\n            return Some(Box::new(CompiledPluginModuleBytes::new(\n                key.to_string(),\n                cache,\n            )));\n        }\n\n        // Next, read serialzied bytes from filesystem cache.\n        #[cfg(all(not(target_arch = \"wasm32\"), feature = \"filesystem_cache\"))]","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/swc-project/swc/blob/d7d74346665e36e692aa07e13d4ee3ee692ee35c/crates/swc_plugin_runner/src/cache.rs#L126-L162","documentation":"PluginModuleCacheInner::store_bytes_from_path can only read a plugin binary from a physical path when the host was compiled with the filesystem_cache code path (cfg(not(target_arch = \"wasm32\"), feature = \"filesystem_cache\")). When that cfg block is compiled out, execution falls straight through to this bail. It is a capability error: this build of the plugin runner cannot accept path-based plugin loading at all.","triggerScenarios":"Compiling wasm plugins into the cache on a host built for target_arch = \"wasm32\", or a swc_plugin_runner build without the filesystem_cache feature, and then configuring jsc.experimental.plugins (which always ends in store_bytes_from_path).","commonSituations":"Running swc in the browser via wasm bindings and leaving plugins in the config; downstream crates depending on swc_plugin_runner with default features off; embedding swc_core in a custom runtime that disables the cache feature.","solutions":["Remove/disable jsc.experimental.plugins for wasm32 or feature-less builds - plugins cannot load there","Rebuild the host with the filesystem_cache feature enabled (non-wasm32 target)","If you vendor swc_plugin_runner, ensure the feature propagates through your dependency tree (cargo tree -f '{p} {f}' -p swc_plugin_runner)"],"exampleFix":"# Cargo.toml before\nswc_plugin_runner = \"0.\"\n\n# Cargo.toml after\nswc_plugin_runner = { version = \"0.\", features = [\"filesystem_cache\"] }","handlingStrategy":"validation","validationCode":"// Rust: gate plugin config on build capability before transforming\nfn plugins_supported() -> bool {\n    #[cfg(all(not(target_arch = \"wasm32\"), feature = \"filesystem_cache\"))]\n    { true }\n    #[cfg(not(all(not(target_arch = \"wasm32\"), feature = \"filesystem_cache\")))]\n    { false }\n}\n\nif !plugins.is_empty() && !plugins_supported() {\n    anyhow::bail!(\"plugins requested but this build cannot load plugins from paths\");\n}","typeGuard":null,"tryCatchPattern":"// Rust: catch at config load with an actionable message\nif let Err(e) = swc::try_with_handler(...) { /* ... */ }\nmatch err.downcast_ref::<anyhow::Error>() {\n    Some(e) if e.to_string().contains(\"Filesystem cache is not enabled\") => {\n        return Err(anyhow!(\"disable jsc.experimental.plugins or rebuild with filesystem_cache\"));\n    }\n    _ => return Err(err),\n}","preventionTips":["Decide plugin support at build time: wasm32/feature-less targets must ship plugin-free configs","Assert cargo features in CI for downstream builds (cargo tree -e features | grep filesystem_cache)","Treat this as a config error to validate at startup, not a runtime surprise"],"tags":["swc","plugins","cache","build-features","wasm32"],"backgroundTag":null,"analyzedSha":"d7d74346665e36e692aa07e13d4ee3ee692ee35c","analyzedAt":"2026-08-16T12:41:13.160Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}