{"record":{"id":"222047329d1bc7ba","repo":"swc-project/swc","slug":"expected-percentage-number-function-math-functi","errorCode":null,"errorMessage":"Expected percentage, number, function (math functions) or ident (with 'none' value) token","messagePattern":"Expected percentage, number, function \\(math functions\\) or ident \\(with 'none' value\\) token","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/values_and_units/mod.rs","lineNumber":1555,"sourceCode":"                            }\n                            Token::Function { value, .. } if is_math_function(value) => {\n                                Ok(Some(ComponentValue::Function(parser.parse()?)))\n                            }\n                            tok!(\"ident\") if !matches!(&*lower_fname, \"device-cmyk\") => {\n                                let ident: Box<Ident> = parser.parse()?;\n\n                                if ident.value.eq_ignore_ascii_case(\"none\") {\n                                    Ok(Some(ComponentValue::Ident(ident)))\n                                } else {\n                                    Err(Error::new(\n                                        ident.span,\n                                        ErrorKind::Expected(\"'none' value of an ident token\"),\n                                    ))\n                                }\n                            }\n                            _ => {\n                                if !has_variable_before {\n                                    Err(Error::new(\n                                        parser.input.cur_span(),\n                                        ErrorKind::Expected(\n                                            \"percentage, number, function (math functions) or \\\n                                             ident (with 'none' value) token\",\n                                        ),\n                                    ))\n                                } else {\n                                    Ok(None)\n                                }\n                            }\n                        },\n                        &mut has_variable,\n                    )?;\n\n                    if let Some(alpha_value) = alpha_value {\n                        values.push(alpha_value);\n                    }\n","sourceCodeStart":1537,"sourceCodeEnd":1573,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/values_and_units/mod.rs#L1537-L1573","documentation":"Fired while parsing a color function component: expected a percentage, number, math function, or the ident 'none', but the current token is none of these (except that within device-cmyk the ident case is excluded). The component cannot be parsed into any accepted form.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1555 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a percentage or number for the channel value","Use a math function (calc, min, max, ...) or 'none' where allowed","Remove invalid identifiers from the component slot"],"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-14T05:17:10.506Z"}