{"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":null,"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/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_plugin_runner/src/cache.rs#L126-L162","documentation":"PluginCache::store_bytes_from_path in swc_plugin_runner reads a plugin (.wasm) binary from a physical path and populates its caches. The entire read/store block is compiled only under cfg(all(not(target_arch = \"wasm32\"), feature = \"filesystem_cache\")); when that configuration is false (the `filesystem_cache` cargo feature is off, or the host targets wasm32), execution falls straight to bail!('Filesystem cache is not enabled, cannot read plugin from phsyical path'). So the API was asked to load a plugin from disk in a build that cannot do filesystem caching.","triggerScenarios":"Calling store_bytes_from_path(binary_path, key) on a swc_plugin_runner built without the `filesystem_cache` feature, or running the plugin runner on wasm32 where filesystem plugin loading is unsupported.","commonSituations":"Using swc core with default features that exclude plugin filesystem caching while a plugin path is configured; embedding the plugin runner in a wasm host (playground) but passing a physical plugin path; feature-flag drift after upgrading swc_core where the feature moved.","solutions":["Enable the `filesystem_cache` feature on swc_plugin_runner (or the swc_core feature that turns it on) in your Cargo.toml","On wasm32 targets, load plugins from bytes (store_bytes / in-memory paths) instead of a physical path","If plugins are optional, guard plugin configuration so paths are only set when the host build supports filesystem caching"],"exampleFix":"# before\nswc_core = { version = \"...\", features = [\"ecma_plugin_transform\"] }\n# plugin loading from path -> bails\n\n# after\nswc_core = { version = \"...\", features = [\"ecma_plugin_transform\", \"plugin_transform_schema_v1\"] }\n# and on swc_plugin_runner consumers:\nswc_plugin_runner = { version = \"...\", features = [\"filesystem_cache\"] }","handlingStrategy":"validation","validationCode":"# Before relying on path-based plugin loading, confirm the host build supports it\ncargo tree -i swc_plugin_runner -f \"{f}\" # must list filesystem_cache when using store_bytes_from_path","typeGuard":null,"tryCatchPattern":"if let Err(e) = cache.store_bytes_from_path(&rt, &path, key) {\n    if e.to_string().contains(\"Filesystem cache is not enabled\") {\n        // fall back to in-memory bytes: cache.store_bytes(...) or skip fs caching\n    } else { return Err(e); }\n}","preventionTips":["Enable `filesystem_cache` (or swc_core's plugin feature set) whenever plugins are loaded from paths","On wasm32 hosts, always load plugins from bytes rather than paths","Encode the feature requirement in your build docs so trimmed feature sets don't silently break plugins"],"tags":["swc-plugin","plugin-cache","cargo-features","filesystem","wasm32"],"backgroundTag":"plugin-cache-not-enabled","analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}