{"record":{"id":"75fd4ebeeee1c6f7","repo":"swc-project/swc","slug":"unexpected-end-of-file-but-expected","errorCode":null,"errorMessage":"Unexpected end of file, but expected '{'","messagePattern":"Unexpected end of file, but expected '\\{'","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/syntax/mod.rs","lineNumber":266,"sourceCode":"\nimpl<I> Parse<QualifiedRule> for Parser<I>\nwhere\n    I: ParserInput,\n{\n    fn parse(&mut self) -> PResult<QualifiedRule> {\n        // To consume a qualified rule:\n\n        // Create a new qualified rule with its prelude initially set to an empty list,\n        // and its value initially set to nothing.\n        let span = self.input.cur_span();\n        let mut prelude = Vec::new();\n\n        // Repeatedly consume the next input token:\n        loop {\n            // <EOF-token>\n            // This is a parse error. Return nothing.\n            if is!(self, EOF) {\n                return Err(Error::new(\n                    span!(self, span.lo),\n                    ErrorKind::EofButExpected(\"'{'\"),\n                ));\n            }\n\n            match cur!(self) {\n                // <semicolon-token>\n                // If mixed with declarations is true, this is a parse error; return nothing.\n                // Otherwise, append a <semicolon-token> to the qualified rule’s prelude.\n                tok!(\";\") => {\n                    if self.ctx.mixed_with_declarations {\n                        let span = self.input.cur_span();\n\n                        return Err(Error::new(span, ErrorKind::Expected(\"'{'\")));\n                    } else {\n                        let component_value = self.parse_as::<ComponentValue>()?;\n\n                        prelude.push(component_value);","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/syntax/mod.rs#L248-L284","documentation":"Fired while parsing a QualifiedRule per the CSS qualified-rule consumption algorithm: the token stream hit EOF before the rule's '{ ... }' block was found, so the rule is unterminated. Input at fault is a truncated stylesheet fragment such as `div { color: red` where the closing context never appears.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/syntax/mod.rs:266 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Close the qualified rule with a { ... } block","Surface the error from the parse result","Fix the truncated CSS"],"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-14T00:17:10.932Z"}