swc-project/swc · error · Error
The CSS-wide keywords are not valid custom ident, found '{va
Error message
The CSS-wide keywords are not valid custom ident, found '{value}' What it means
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.
Source
Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1837
}
impl<I> Parse<CustomIdent> for Parser<I>
where
I: ParserInput,
{
fn parse(&mut self) -> PResult<CustomIdent> {
let span = self.input.cur_span();
if !is!(self, Ident) {
return Err(Error::new(span, ErrorKind::Expected("Ident")));
}
match bump!(self) {
Token::Ident { value, raw, .. } => {
if matches_eq_ignore_ascii_case!(
value, "initial", "inherit", "unset", "revert", "default"
) {
return Err(Error::new(span, ErrorKind::InvalidCustomIdent(value)));
}
Ok(CustomIdent {
span,
value,
raw: Some(raw),
})
}
_ => {
unreachable!()
}
}
}
}
impl<I> Parse<DashedIdent> for Parser<I>
where
I: ParserInput,View on GitHub (pinned to 5176682b65)
Solutions
- Choose a name that is not a CSS-wide keyword
- Escape or rename the identifier if it must keep a similar meaning
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1837 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17).
Data as JSON: /api/errors/662ab1591fe37eed.
Report an issue: GitHub.