swc-project/swc · error · Error
Expected valid dashed, '--' is not valid custom property nam
Error message
Expected valid dashed, '--' is not valid custom property name
What it means
Fired by the CustomPropertyName parser: the ident is exactly '--' with nothing after the prefix. Per spec, '--' alone is not a valid custom property name; at least one character must follow the two hyphens.
Source
Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1912
where
I: ParserInput,
{
fn parse(&mut self) -> PResult<CustomPropertyName> {
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 !value.starts_with("--") {
return Err(Error::new(
span,
ErrorKind::Expected("'--' at the start of custom property name"),
));
} else if &*value == "--" {
return Err(Error::new(
span,
ErrorKind::Expected("valid dashed, '--' is not valid custom property name"),
));
}
Ok(CustomPropertyName {
span,
value,
raw: Some(raw),
})
}
_ => {
unreachable!()
}
}
}
}
View on GitHub (pinned to 5176682b65)
Solutions
- Add a name after the '--' prefix (e.g. '--spacing')
- Remove the empty custom property declaration
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1912 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/769c80619b5fa8fe.
Report an issue: GitHub.