{"record":{"id":"48678e7b2a63a21e","repo":"swc-project/swc","slug":"plugin-s-ast-schema-version-is-not-compatible-with","errorCode":null,"errorMessage":"Plugin's AST schema version is not compatible with host's. Host: {}, Plugin: {}","messagePattern":"Plugin's AST schema version is not compatible with host's\\. Host: (.+?), Plugin: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/swc_plugin_runner/src/transform_executor.rs","lineNumber":126,"sourceCode":"     * the host. Returns true if it's compatible, false otherwise.\n     *\n     * Host should appropriately handle if plugin is not compatible to the\n     * current runtime.\n     */\n    #[allow(unreachable_code)]\n    pub fn is_transform_schema_compatible(&mut self) -> Result<(), Error> {\n        #[cfg(any(\n            feature = \"plugin_transform_schema_v1\",\n            feature = \"plugin_transform_schema_vtest\"\n        ))]\n        return {\n            let host_schema_version = PLUGIN_TRANSFORM_AST_SCHEMA_VERSION;\n\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}","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/swc-project/swc/blob/d7d74346665e36e692aa07e13d4ee3ee692ee35c/crates/swc_plugin_runner/src/transform_executor.rs#L108-L144","documentation":"Version gate in TransformExecutor::is_transform_schema_compatible: the host's PLUGIN_TRANSFORM_AST_SCHEMA_VERSION must be >= the plugin's ast_schema_version (read from PluginCorePkgDiagnostics). If the plugin was compiled against a newer AST schema than the host understands, serialized ASTs are incompatible and the runner refuses to execute before touching your code.","triggerScenarios":"Loading a wasm plugin built with a newer swc_core than the host's swc_core/plugin runner - e.g. updating a published plugin while pinning an old @swc/core, or the reverse drift in a monorepo mixing versions.","commonSituations":"npm lockfiles keeping an old @swc/core while a sibling dependency ships a newer first-party plugin; locally developed plugins rebuilt against latest swc_core and tested against an older embedded host.","solutions":["Upgrade the host (@swc/core or your swc_core dependency) to at least the plugin's schema version, then retry","Or rebuild the plugin against the older swc_core matching the host","Print both versions from the error (Host: x, Plugin: y) to decide which side to move"],"exampleFix":"# before: host pinned old, plugin newer\n@swc/core@1.3.40 + plugin built with swc_core@10\n\n# after: align by upgrading the host\n@swc/core@latest  # host schema >= plugin schema","handlingStrategy":"try-catch","validationCode":"// Rust: preflight compatibility when you control both versions\n// (mirrors the host check host >= plugin)\nfn schema_ok(host_version: u32, plugin_version: u32) -> bool {\n    host_version >= plugin_version\n}\n// obtain plugin_version from the plugin's diagnostics/manifest before loading","typeGuard":null,"tryCatchPattern":"match plugins.load(...) {\n    Err(e) if e.to_string().contains(\"AST schema version is not compatible\") => {\n        // message carries Host: x, Plugin: y - parse and tell the user which side to bump\n        return Err(e.context(\"upgrade @swc/core (host) or rebuild the plugin against the host's swc_core\"));\n    }\n    other => other,\n}","preventionTips":["Upgrade @swc/core and first-party plugins together in one change","In monorepos, dedupe swc_core so one version wins across host and plugins","Add a startup version check comparing host schema version to plugin manifests"],"tags":["swc","plugins","schema-version","version-mismatch","wasm"],"backgroundTag":null,"analyzedSha":"d7d74346665e36e692aa07e13d4ee3ee692ee35c","analyzedAt":"2026-08-16T12:41:13.160Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}