{"record":{"id":"c5e2e00e86c7389b","repo":"swc-project/swc","slug":"expected-percentage-function-math-functions-or","errorCode":null,"errorMessage":"Expected percentage, function (math functions) or ident (with 'none' value) token","messagePattern":"Expected percentage, 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":1506,"sourceCode":"                            }\n                            tok!(\"ident\") => {\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                            Token::Function { value, .. } if is_math_function(value) => {\n                                Ok(Some(ComponentValue::Function(parser.parse()?)))\n                            }\n                            _ => {\n                                if !has_variable_before {\n                                    Err(Error::new(\n                                        parser.input.cur_span(),\n                                        ErrorKind::Expected(\n                                            \"percentage, function (math functions) or ident (with \\\n                                             'none' value) token\",\n                                        ),\n                                    ))\n                                } else {\n                                    Ok(None)\n                                }\n                            }\n                        },\n                        &mut has_variable,\n                    )?;\n\n                    if let Some(number_or_percentage_or_none) = number_or_percentage_or_none {\n                        values.push(number_or_percentage_or_none);\n                    }\n","sourceCodeStart":1488,"sourceCodeEnd":1524,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/values_and_units/mod.rs#L1488-L1524","documentation":"Fired while parsing a color function component (e.g. an alpha or channel slot): the value must be a percentage, a math function, or the ident 'none', but the current token is something else. An ident other than 'none' is specifically rejected here.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1506 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a percentage (e.g. '50%'), a math function (e.g. 'calc(...)'), or the keyword 'none'","Remove unsupported idents in the channel/alpha position"],"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"}