{"record":{"id":"662ab1591fe37eed","repo":"swc-project/swc","slug":"the-css-wide-keywords-are-not-valid-custom-ident-662ab1","errorCode":null,"errorMessage":"The CSS-wide keywords are not valid custom ident, found '{value}'","messagePattern":"The CSS-wide keywords are not valid custom ident, found '(.+?)'","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/values_and_units/mod.rs","lineNumber":1837,"sourceCode":"}\n\nimpl<I> Parse<CustomIdent> for Parser<I>\nwhere\n    I: ParserInput,\n{\n    fn parse(&mut self) -> PResult<CustomIdent> {\n        let span = self.input.cur_span();\n\n        if !is!(self, Ident) {\n            return Err(Error::new(span, ErrorKind::Expected(\"Ident\")));\n        }\n\n        match bump!(self) {\n            Token::Ident { value, raw, .. } => {\n                if matches_eq_ignore_ascii_case!(\n                    value, \"initial\", \"inherit\", \"unset\", \"revert\", \"default\"\n                ) {\n                    return Err(Error::new(span, ErrorKind::InvalidCustomIdent(value)));\n                }\n\n                Ok(CustomIdent {\n                    span,\n                    value,\n                    raw: Some(raw),\n                })\n            }\n            _ => {\n                unreachable!()\n            }\n        }\n    }\n}\n\nimpl<I> Parse<DashedIdent> for Parser<I>\nwhere\n    I: ParserInput,","sourceCodeStart":1819,"sourceCodeEnd":1855,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/values_and_units/mod.rs#L1819-L1855","documentation":"Fired by the CustomIdent parser: the ident matched a CSS-wide keyword ('initial', 'inherit', 'unset', 'revert', 'default', case-insensitive). Per spec these keywords are excluded from <custom-ident>, so using one as a custom ident is invalid.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1837 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a name that is not a CSS-wide keyword","Escape or rename the identifier if it must keep a similar meaning"],"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"}