{"record":{"id":"9fb22c63acee2e71","repo":"swc-project/swc","slug":"expected-number-dimension-percentage-ide","errorCode":null,"errorMessage":"Expected 'number', 'dimension', 'percentage', 'ident', '(' or 'function' tokens","messagePattern":"Expected 'number', 'dimension', 'percentage', 'ident', '\\(' or 'function' tokens","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/values_and_units/mod.rs","lineNumber":3296,"sourceCode":"                expect!(self, \"(\");\n\n                self.input.skip_ws();\n\n                let mut calc_sum_in_parens: CalcSum = self.parse()?;\n\n                self.input.skip_ws();\n\n                expect!(self, \")\");\n\n                calc_sum_in_parens.span = span!(self, span.lo);\n\n                Ok(CalcValue::Sum(calc_sum_in_parens))\n            }\n            tok!(\"function\") => Ok(CalcValue::Function(self.parse()?)),\n            _ => {\n                let span = self.input.cur_span();\n\n                return Err(Error::new(\n                    span,\n                    ErrorKind::Expected(\n                        \"'number', 'dimension', 'percentage', 'ident', '(' or 'function' tokens\",\n                    ),\n                ));\n            }\n        }\n    }\n}\n\nimpl<I> Parse<FamilyName> for Parser<I>\nwhere\n    I: ParserInput,\n{\n    fn parse(&mut self) -> PResult<FamilyName> {\n        match cur!(self) {\n            tok!(\"string\") => Ok(FamilyName::Str(self.parse()?)),\n            tok!(\"ident\") => {","sourceCodeStart":3278,"sourceCodeEnd":3314,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/values_and_units/mod.rs#L3278-L3314","documentation":"Fired while parsing a CalcValue inside math functions: a calc value must be a number, dimension, percentage, ident (constants like `pi`/`e`/`infinity`/`NaN`), a parenthesized sum, or a nested function, and the current token matched none of these. Input at fault is a calc() expression containing an unexpected token, e.g. `calc(\"a\" + 1)`.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:3296 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a number, dimension, percentage, math constant, parenthesized sum, or math function as the operand","Remove the invalid token from the calc expression"],"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"}