swc-project/swc · error

Expected '+' character after 'u' in unicode range

Error message

Expected '+' character after 'u' in unicode range

What it means

Fired during <urange> validation: after concatenating tokens, the text following the leading 'u' must begin with '+' (U+002B). Per the spec's urange algorithm, a missing plus sign makes the production invalid and parsing exits with this error.

Source

Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2897

                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(
                span,
                ErrorKind::Expected("'+' character after 'u' in unicode range"),
            ));
        } else {
            next = chars.next();
        }

        // 3. Consume as many hex digits from text as possible. then consume as many
        // U+003F QUESTION MARK (?) code points as possible. If zero code points
        // were consumed, or more than six code points were consumed, this is an
        // invalid <urange>, and this algorithm must exit.
        let mut start = String::new();

        loop {
            match next {
                Some(c) if c.is_ascii_digit() => {
                    start.push(c);

View on GitHub (pinned to 5176682b65)

Solutions

  1. Write the range as 'U+...' with the plus sign after U
  2. Remove the space between U and + if present
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2897 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/53a8b1ddad04d63f. Report an issue: GitHub.