swc-project/swc · error
Expected dimension, number or '?' delim token
Error message
Expected dimension, number or '?' delim token
What it means
Fired while parsing a UnicodeRange: after the leading `u`, the parser expected a dimension token (hex digits with `+` unit) or a number, or a `?` delim for wildcard forms, and found none of them. Input at fault is a malformed @unicode-range value such as `U+` with nothing following, or other tokens that do not fit any Unicode range production.
Source
Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2879
unicode_range.push_str(&raw.1);
loop {
if !is!(self, "?") {
break;
}
let question = match bump!(self) {
Token::Delim { value } => value,
_ => {
unreachable!();
}
};
unicode_range.push(question);
}
}
_ => {
return Err(Error::new(
span,
ErrorKind::Expected("dimension, number or '?' delim token"),
));
}
}
let mut chars = unicode_range.chars();
// 1. Skipping the first u token, concatenate the representations of all the
// tokens in the production together. Let this be text.
chars.next();
// 2. If the first character of text is U+002B PLUS SIGN, consume it. Otherwise,
// this is an invalid <urange>, and this algorithm must exit.
let mut next = chars.next();
if next != Some('+') {
return Err(Error::new(View on GitHub (pinned to 5176682b65)
Solutions
- Follow 'U' with '+', hex digits, or '?' wildcards: 'U+4??'
- Remove invalid tokens after the leading U
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2879 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/c434a7a0bee58fa9.
Report an issue: GitHub.