{"record":{"id":"0cda59da45d8069b","repo":"swc-project/swc","slug":"unable-to-access-unknown-nodes-0cda59","errorCode":null,"errorMessage":"unable to access unknown nodes","messagePattern":"unable to access unknown nodes","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_estree_compat/src/babelify/function.rs","lineNumber":94,"sourceCode":"                base: ctx.base(self.span),\n                decorators: Some(self.decorators.babelify(ctx)),\n                ..o.babelify(ctx)\n            })),\n            Pat::Assign(a) => BabelParam::Pat(Pattern::Assignment(AssignmentPattern {\n                base: ctx.base(self.span),\n                decorators: Some(self.decorators.babelify(ctx)),\n                ..a.babelify(ctx)\n            })),\n            Pat::Expr(_) => panic!(\n                \"illegal conversion: Cannot convert {:?} to BabelParam\",\n                &self.pat\n            ),\n            Pat::Invalid(_) => panic!(\n                \"illegal conversion: Cannot convert {:?} to BabelParam\",\n                &self.pat\n            ),\n            #[cfg(swc_ast_unknown)]\n            _ => panic!(\"unable to access unknown nodes\"),\n        }\n    }\n}\n\nimpl Babelify for ParamOrTsParamProp {\n    type Output = BabelParam;\n\n    fn babelify(self, ctx: &Context) -> Self::Output {\n        match self {\n            ParamOrTsParamProp::TsParamProp(p) => BabelParam::TSProp(p.babelify(ctx)),\n            ParamOrTsParamProp::Param(p) => p.babelify(ctx),\n            #[cfg(swc_ast_unknown)]\n            _ => panic!(\"unable to access unknown nodes\"),\n        }\n    }\n}\n","sourceCodeStart":76,"sourceCodeEnd":111,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_estree_compat/src/babelify/function.rs#L76-L111","documentation":"This wildcard arm closes the Pat match inside Param::babelify (function parameters) and compiles only when `--cfg swc_ast_unknown` is set — the cfg SWC plugin builds use to make swc_ecma_ast enums non_exhaustive for cross-version tolerance. If the Pat value holds a variant beyond Ident/Array/Rest/Object/Assign/Expr/Invalid that the linked swc_ecma_ast version does not define, the code panics with 'unable to access unknown nodes'. Like the other unknown-node panics, it signals an AST produced by a different swc version than the one linked in.","triggerScenarios":"A function parameter's Pat enum arriving from a newer/older swc_ecma_ast across a plugin ABI or mixed-version Cargo graph, carrying a variant this build cannot name.","commonSituations":"Plugin host/plugin version drift; partial swc upgrades leaving swc_estree_compat behind; wasm binaries cached from an older build.","solutions":["Unify swc versions: `cargo tree -i swc_ecma_ast` must show one version; update via swc_core","Upgrade swc_estree_compat alongside swc_ecma_ast so the new Pat variant is covered","Rebuild the plugin/wasm boundary against the host's swc release","Use catch_unwind around babelify to degrade to a per-file error during migration"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn param_pat_known(p: &Pat) -> bool {\n    matches!(\n        p,\n        Pat::Ident(_) | Pat::Array(_) | Pat::Rest(_) | Pat::Object(_) | Pat::Assign(_) | Pat::Expr(_) | Pat::Invalid(_)\n    )\n}","tryCatchPattern":"let out = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| program.babelify(&ctx)))\n    .map_err(|_| anyhow::anyhow!(\"babelify failed: swc_ecma_ast version mismatch (unknown Pat)\"))?;","preventionTips":["Single swc version rule: check `cargo tree -i swc_ecma_ast` in CI","Upgrade swc_estree_compat and swc_ecma_ast atomically","Rebuild plugin/wasm binaries with host upgrades","Include parameter-heavy fixtures in smoke tests"],"tags":["swc","babelify","panic","version-mismatch","non-exhaustive","function-parameters"],"backgroundTag":"ast-version-mismatch","analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}