swc-project/swc · error
Expected 'string' or 'ident' tokens
Error message
Expected 'string' or 'ident' tokens
What it means
Fired by the FamilyName parser: a font family name must be either a quoted string or a sequence of custom idents, but the current token is neither. The parser cannot build a FamilyName node from this token.
Source
Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:3337
loop {
self.input.skip_ws();
if !is!(self, "ident") {
break;
}
value.push(self.parse()?);
}
Ok(FamilyName::SequenceOfCustomIdents(SequenceOfCustomIdents {
span: span!(self, span.lo),
value,
}))
}
_ => {
let span = self.input.cur_span();
return Err(Error::new(
span,
ErrorKind::Expected("'string' or 'ident' tokens"),
));
}
}
}
}
pub(crate) fn is_math_function(name: &Atom) -> bool {
matches_eq_ignore_ascii_case!(
name,
"calc",
"-moz-calc",
"-webkit-calc",
"sin",
"cos",
"tan",
"asin",View on GitHub (pinned to 5176682b65)
Solutions
- Quote multi-word family names: font-family: "Helvetica Neue"
- Use valid identifiers for unquoted names and avoid leading digits
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:3337 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/ce4de2ba9d1bf9b4.
Report an issue: GitHub.