{"record":{"id":"989d6f1cf9d7cad4","repo":"swc-project/swc","slug":"expected-a-number","errorCode":null,"errorMessage":"Expected a number","messagePattern":"Expected a number","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/values_and_units/mod.rs","lineNumber":1766,"sourceCode":"                    value: DelimiterValue::Semicolon,\n                });\n            }\n            _ => {\n                unreachable!();\n            }\n        }\n    }\n}\n\nimpl<I> Parse<Integer> for Parser<I>\nwhere\n    I: ParserInput,\n{\n    fn parse(&mut self) -> PResult<Integer> {\n        let span = self.input.cur_span();\n\n        if !is!(self, Number) {\n            return Err(Error::new(span, ErrorKind::ExpectedNumber));\n        }\n\n        let value = bump!(self);\n\n        match value {\n            Token::Number {\n                value,\n                raw,\n                type_flag,\n                ..\n            } => {\n                if type_flag == NumberType::Number {\n                    return Err(Error::new(span, ErrorKind::Expected(\"integer type\")));\n                }\n\n                Ok(Integer {\n                    span,\n                    value: value.round() as i64,","sourceCodeStart":1748,"sourceCodeEnd":1784,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/values_and_units/mod.rs#L1748-L1784","documentation":"Fired while parsing an Integer node: the current token was not a Number token, which is required before an integer value can be produced. ErrorKind::ExpectedNumber is the sentinel for this validation guard; input at fault is any context expecting an integer that receives a different token, e.g. `z-index: auto 5x` style mismatches or a missing value.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1766 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a numeric literal where an integer is expected","Remove quotes or units that turn the value into a non-number token"],"exampleFix":null,"handlingStrategy":"type-guard","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"}