{"record":{"id":"47d5e749ea77640a","repo":"swc-project/swc","slug":"plugin-runner-cannot-detect-plugin-s-schema-versio","errorCode":null,"errorMessage":"Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versions","messagePattern":"Plugin runner cannot detect plugin's schema version\\. Ensure host is compiled with proper versions","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_plugin_runner/src/transform_executor.rs","lineNumber":139,"sourceCode":"\n            // TODO: this is incomplete\n            if host_schema_version >= self.plugin_core_diag.ast_schema_version {\n                Ok(())\n            } else {\n                anyhow::bail!(\n                    \"Plugin's AST schema version is not compatible with host's. Host: {}, Plugin: \\\n                     {}\",\n                    host_schema_version,\n                    self.plugin_core_diag.ast_schema_version\n                )\n            }\n        };\n\n        #[cfg(not(all(\n            feature = \"plugin_transform_schema_v1\",\n            feature = \"plugin_transform_schema_vtest\"\n        )))]\n        anyhow::bail!(\n            \"Plugin runner cannot detect plugin's schema version. Ensure host is compiled with \\\n             proper versions\"\n        )\n    }\n}\n\n/// A struct encapsule executing a plugin's transform.\npub struct TransformExecutor {\n    source_map: Arc<SourceMap>,\n    unresolved_mark: swc_common::Mark,\n    metadata_context: Arc<TransformPluginMetadataContext>,\n    plugin_env_vars: Option<Arc<Vec<swc_atoms::Atom>>>,\n    plugin_config: Option<serde_json::Value>,\n    module_bytes: Box<dyn PluginModuleBytes>,\n    runtime: Arc<dyn runtime::Runtime>,\n}\n\n#[cfg(feature = \"encoding-impl\")]","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_plugin_runner/src/transform_executor.rs#L121-L157","documentation":"The sibling of the schema check: when the host was compiled without any of the plugin transform schema features (plugin_transform_schema_v1 / plugin_transform_schema_vtest), the cfg(not(all(...))) branch unconditionally bails with 'Plugin runner cannot detect plugin's schema version'. It is a build-configuration error: this swc_plugin_runner build has no AST schema knowledge at all, so it cannot even compare versions with a plugin.","triggerScenarios":"Compiling swc_plugin_runner (or swc_core's plugin transform integration) with the schema features disabled, then attempting any plugin transform — is_transform_schema_compatible always bails regardless of the plugin.","commonSituations":"Custom builds of swc_core with a trimmed feature set; downstream crates overriding default features and accidentally dropping plugin_transform_schema_v1; wasm/embedded hosts compiled with a minimal feature graph.","solutions":["Enable the `plugin_transform_schema_v1` feature (via swc_core's plugin feature set) on the host build","Restore default features if you trimmed them without intending to drop plugin support","If plugins are genuinely unsupported in your build, stop configuring plugin entries rather than relying on them"],"exampleFix":"# before\nswc_core = { version = \"...\", default-features = false, features = [\"ecma_transforms\"] }\n\n# after\nswc_core = { version = \"...\", default-features = false, features = [\n  \"ecma_transforms\",\n  \"ecma_plugin_transform\", # enables plugin_transform_schema_v1\n] }","handlingStrategy":"validation","validationCode":"# Fail fast at build time if the host lacks plugin schema support\ncargo tree -i swc_plugin_runner -f \"{f}\" | grep -q plugin_transform_schema_v1 || echo 'WARN: plugin transforms will always fail'","typeGuard":null,"tryCatchPattern":"match executor.is_transform_schema_compatible() {\n    Ok(()) => { /* run plugin */ }\n    Err(e) if e.to_string().contains(\"cannot detect plugin's schema version\") => {\n        // host built without schema features: rebuild with plugin_transform_schema_v1 or disable plugins\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["When trimming swc_core default features, explicitly keep the plugin transform feature set if you load plugins","Add a build check (cargo tree) that plugin schema features are present when plugin config exists","Document required cargo features next to plugin configuration in your build scripts"],"tags":["swc-plugin","cargo-features","build-config","schema-version","feature-flags"],"backgroundTag":"plugin-schema-version-mismatch","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"}