{"record":{"id":"ea0651e422b06a63","repo":"swc-project/swc","slug":"expected-percentage-token","errorCode":null,"errorMessage":"Expected percentage token","messagePattern":"Expected percentage token","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/values_and_units/mod.rs","lineNumber":2542,"sourceCode":"\n                Ok(CmykComponent::Function(self.parse()?))\n            }\n            _ => {\n                unreachable!()\n            }\n        }\n    }\n}\n\nimpl<I> Parse<Percentage> for Parser<I>\nwhere\n    I: ParserInput,\n{\n    fn parse(&mut self) -> PResult<Percentage> {\n        let span = self.input.cur_span();\n\n        if !is!(self, Percentage) {\n            return Err(Error::new(span, ErrorKind::Expected(\"percentage token\")));\n        }\n\n        match bump!(self) {\n            Token::Percentage { value, raw } => {\n                let value = Number {\n                    span: Span::new(span.lo, span.hi - BytePos(1)),\n                    value,\n                    raw: Some(raw),\n                };\n\n                Ok(Percentage { span, value })\n            }\n            _ => {\n                unreachable!()\n            }\n        }\n    }\n}","sourceCodeStart":2524,"sourceCodeEnd":2560,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/values_and_units/mod.rs#L2524-L2560","documentation":"Fired while parsing a Percentage: the current token was not a Percentage token (e.g. 50%), which is required to build a Percentage node. This `if !is!(self, Percentage)` check is a validation guard; input at fault is a percentage-required context receiving a plain number or other token.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2542 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the '%' suffix to the number","Use a Number or Dimension parser if a different value type 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-14T05:17:10.506Z"}