{"record":{"id":"af3e5c76bd9dd3af","repo":"swc-project/swc","slug":"expected-dimension-token","errorCode":null,"errorMessage":"Expected dimension token","messagePattern":"Expected dimension token","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/values_and_units/mod.rs","lineNumber":1963,"sourceCode":"                value,\n                raw: Some(raw),\n            }),\n            _ => {\n                unreachable!()\n            }\n        }\n    }\n}\n\nimpl<I> Parse<Dimension> for Parser<I>\nwhere\n    I: ParserInput,\n{\n    fn parse(&mut self) -> PResult<Dimension> {\n        let span = self.input.cur_span();\n\n        if !is!(self, Dimension) {\n            return Err(Error::new(span, ErrorKind::Expected(\"dimension token\")));\n        }\n\n        match cur!(self) {\n            Token::Dimension {\n                dimension: dimension_token,\n            } => {\n                match &dimension_token.unit {\n                    // <length>\n                    unit if is_length_unit(unit)\n                        || (self.ctx.in_container_at_rule && is_container_lengths_unit(unit)) =>\n                    {\n                        Ok(Dimension::Length(self.parse()?))\n                    }\n                    // <angle>\n                    unit if is_angle_unit(unit) => Ok(Dimension::Angle(self.parse()?)),\n                    // <time>\n                    unit if is_time_unit(unit) => Ok(Dimension::Time(self.parse()?)),\n                    // <frequency>","sourceCodeStart":1945,"sourceCodeEnd":1981,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/values_and_units/mod.rs#L1945-L1981","documentation":"Fired while parsing a Dimension: the current token was not a Dimension token (a number with a unit, e.g. 10px), which is required to build a Dimension node. This `if !is!(self, Dimension)` check is a validation guard; input at fault is a length/angle/etc. position in input that receives a bare number, string, or other token.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1963 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a number with a unit (e.g. '10px', '2em')","Use a plain number or percentage type if no unit was intended"],"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-14T00:17:10.932Z"}