{"record":{"id":"355e52ad0cef7417","repo":"swc-project/swc","slug":"failed-to-parse-input-to-quote","errorCode":null,"errorMessage":"failed to parse input to quote!()","messagePattern":"failed to parse input to quote!\\(\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_quote_macros/src/lib.rs","lineNumber":30,"sourceCode":"    ret_type::parse_input_type,\n};\n\nmod ast;\nmod builder;\nmod ctxt;\nmod input;\nmod ret_type;\n\n/// Don't invoke this macro directly, use the `quote!` macro from\n/// `swc_ecma_quote` instead.\n#[proc_macro]\npub fn internal_quote(input: proc_macro::TokenStream) -> proc_macro::TokenStream {\n    let QuoteInput {\n        src,\n        as_token: _,\n        output_type,\n        vars,\n    } = syn::parse::<QuoteInput>(input).expect(\"failed to parse input to quote!()\");\n\n    let ret_type =\n        parse_input_type(&src.value(), &output_type).expect(\"failed to parse input type\");\n\n    let vars = vars.map(|v| v.1);\n\n    let (stmts, vars) = if let Some(vars) = vars {\n        prepare_vars(&ret_type, vars)\n    } else {\n        Default::default()\n    };\n\n    let cx = Ctx { vars };\n\n    let expr_for_ast_creation = ret_type.to_code(&cx);\n\n    syn::Expr::Block(ExprBlock {\n        attrs: Default::default(),","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_quote_macros/src/lib.rs#L12-L48","documentation":"The internal_quote proc-macro (behind swc_ecma_quote's quote! macro) failed to parse its input tokens into the QuoteInput structure — the expected form is a string literal plus optional type annotation and variable bindings. This fires at compile time when the quote! invocation's syntax deviates from that grammar, before the embedded source is even parsed into AST nodes.","triggerScenarios":"Thrown at crates/swc_ecma_quote_macros/src/lib.rs:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a string literal as the macro input, e.g. quote!(\"const a = 1;\")","Check variable bindings use the documented `src as Type` / var syntax","Ensure the string is balanced and contains no unescaped quotes","Use the public quote! macro from swc_ecma_quote instead of invoking internal_quote directly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}