swc-project/swc · error · Error
Expected dashed-ident must be at least 3 characters
Error message
Expected dashed-ident must be at least 3 characters
What it means
Fired by the DashedIdent parser: the ident starts with '--' but has no characters after the prefix (value length < 3), which cannot name anything. A dashed ident must be '--' plus at least one character.
Source
Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1874
{
fn parse(&mut self) -> PResult<DashedIdent> {
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 dashed-ident"),
));
}
if value.len() < 3 {
return Err(Error::new(
span,
ErrorKind::Expected("dashed-ident must be at least 3 characters"),
));
}
Ok(DashedIdent {
span,
value: self.input.atom(&value[2..]),
raw: Some(raw),
})
}
_ => {
unreachable!()
}
}
}
}
View on GitHub (pinned to 5176682b65)
Solutions
- Add at least one character after the '--' prefix (e.g. '--x')
- Remove the empty placeholder if it was accidental
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:1874 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/a2fde72d32b17f20.
Report an issue: GitHub.