{"record":{"id":"71fe4ec69d0fadd8","repo":"swc-project/swc","slug":"unexpected-token","errorCode":null,"errorMessage":"Unexpected '{' token","messagePattern":"Unexpected '\\{' token","errorType":"validation","errorClass":"swc_css_parser::Error","httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/at_rules/mod.rs","lineNumber":457,"sourceCode":"\n        if !is!(self, EOF) {\n            let span = self.input.cur_span();\n\n            return Err(Error::new(\n                span,\n                ErrorKind::Unexpected(\"tokens in at-rule prelude\"),\n            ));\n        }\n\n        Ok(prelude)\n    }\n\n    pub(super) fn parse_at_rule_block(&mut self, name: &str) -> PResult<Vec<ComponentValue>> {\n        let block_contents = match name {\n            \"charset\" => {\n                let span = self.input.cur_span();\n\n                return Err(Error::new(span, ErrorKind::Unexpected(\"'{' token\")));\n            }\n            \"color-profile\" => {\n                let declaration_list: Vec<DeclarationOrAtRule> = self.parse()?;\n                let declaration_list: Vec<ComponentValue> = declaration_list\n                    .into_iter()\n                    .map(ComponentValue::from)\n                    .collect();\n\n                declaration_list\n            }\n            \"container\" => match self.ctx.block_contents_grammar {\n                BlockContentsGrammar::StyleBlock => {\n                    let ctx = Ctx {\n                        in_container_at_rule: true,\n                        ..self.ctx\n                    };\n                    let style_blocks = self.with_ctx(ctx).parse_as::<Vec<StyleBlock>>()?;\n                    let style_blocks: Vec<ComponentValue> =","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/at_rules/mod.rs#L439-L475","documentation":"Fired in parse_at_rule_block when the at-rule named in source is `charset`: @charset is defined to have only a prelude (a string) and no block, so encountering a '{' that would start a block is a syntax error. Input at fault is any `@charset \"utf-8\" { ... }`-style rule that carries a block body.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/at_rules/mod.rs:457 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the block after block-less at-rules like @charset or @import","Surface the collected error","Skip the invalid rule"],"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"}