{"record":{"id":"767d916ad2b4af8f","repo":"swc-project/swc","slug":"unknown-suffix","errorCode":null,"errorMessage":"Unknown suffix `{}`","messagePattern":"Unknown suffix `(.+?)`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_transforms_macros/src/parallel.rs","lineNumber":45,"sourceCode":"        .unwrap_or(false);\n\n    item.items.push(ImplItem::Fn(make_par_visit_method(\n        mode,\n        \"module_items\",\n        explode,\n    )));\n    item.items\n        .push(ImplItem::Fn(make_par_visit_method(mode, \"stmts\", explode)));\n\n    item\n}\n\nfn node_type(suffix: &str) -> Type {\n    match suffix {\n        \"module_items\" => parse_quote!(ModuleItem),\n        \"stmts\" => parse_quote!(Stmt),\n        _ => {\n            unimplemented!(\"Unknown suffix `{}`\", suffix)\n        }\n    }\n}\n\nfn post_visit_hook(mode: Mode, suffix: &str) -> Option<Expr> {\n    match suffix {\n        \"module_items\" => Some(match mode {\n            Mode::Fold => parse_quote!(\n                swc_ecma_transforms_base::perf::Parallel::after_module_items(self, &mut nodes)\n            ),\n\n            Mode::VisitMut => parse_quote!(\n                swc_ecma_transforms_base::perf::Parallel::after_module_items(self, nodes)\n            ),\n        }),\n        \"stmts\" => Some(match mode {\n            Mode::Fold => parse_quote!(swc_ecma_transforms_base::perf::Parallel::after_stmts(\n                self, &mut nodes","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_transforms_macros/src/parallel.rs#L27-L63","documentation":"Internal panic inside the #[parallel] proc macro's node_type() helper, which maps a method suffix to the AST node type it traverses. Only \"module_items\" (-> ModuleItem) and \"stmts\" (-> Stmt) are mapped; the expand() function itself only ever generates those two, so end users cannot trigger this through normal attribute usage.","triggerScenarios":"Only reachable by modifying swc_ecma_transforms_macros itself: adding a make_par_visit_method call with a new suffix (e.g. \"exprs\") without extending node_type()'s match arms.","commonSituations":"Contributing a new parallel traversal method to the swc macro crate and forgetting to register the suffix-to-type mapping in node_type().","solutions":["If extending the macro, add a match arm mapping the new suffix to its node type, e.g. `\"exprs\" => parse_quote!(Expr)`","Downstream users hitting this should pin/upgrade to an unmodified release of swc_ecma_transforms_macros","Check the macro invocation only uses supported entry points (module_items/stmts methods)"],"exampleFix":"// before (crates/swc_ecma_transforms_macros/src/parallel.rs)\nfn node_type(suffix: &str) -> Type {\n    match suffix {\n        \"module_items\" => parse_quote!(ModuleItem),\n        \"stmts\" => parse_quote!(Stmt),\n        _ => unimplemented!(\"Unknown suffix `{}`\", suffix),\n    }\n}\n\n// after\nfn node_type(suffix: &str) -> Type {\n    match suffix {\n        \"module_items\" => parse_quote!(ModuleItem),\n        \"stmts\" => parse_quote!(Stmt),\n        \"exprs\" => parse_quote!(Expr),\n        _ => unimplemented!(\"Unknown suffix `{}`\", suffix),\n    }\n}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Downstream users: do not patch or vendor swc_ecma_transforms_macros with new suffixes unless node_type() is extended in the same change","Maintainers: any new make_par_visit_method suffix must get a node_type arm plus a fixture test","Treat this panic as an internal invariant violation — report it upstream rather than working around it in user code"],"tags":["proc-macro","swc","rust","internal","compile-time"],"backgroundTag":"proc-macro-unsupported-input","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"}