swc-project/swc · error

Expected no characters after '?' in unicode range

Error message

Expected no characters after '?' in unicode range

What it means

Fired during <urange> wildcard-form validation: if '?' wildcards were consumed in the start value, no code points may remain in the text afterwards. Trailing content after a wildcard range (e.g. 'U+00??-FF') is invalid per the spec.

Source

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

        let len = start.len();

        if len == 0 || len > 6 {
            return Err(Error::new(
                span,
                ErrorKind::Expected(
                    "valid length (minimum 1 or maximum 6 hex digits) in the start of unicode \
                     range",
                ),
            ));
        }

        // If any U+003F QUESTION MARK (?) code points were consumed, then:
        if has_question_mark {
            // 1. If there are any code points left in text, this is an invalid <urange>,
            // and this algorithm must exit.
            if next.is_some() {
                return Err(Error::new(
                    span,
                    ErrorKind::Expected("no characters after '?' in unicode range"),
                ));
            }

            // 2. Interpret the consumed code points
            // as a hexadecimal number, with the U+003F QUESTION MARK (?) code points
            // replaced by U+0030 DIGIT ZERO (0) code points. This is the start value.
            //
            // 3. Interpret the consumed code points as a hexadecimal number again, with the
            // U+003F QUESTION MARK (?) code points replaced by U+0046 LATIN CAPITAL LETTER
            // F (F) code points. This is the end value.
            //

            // 4. Exit this algorithm.
            return Ok(UnicodeRange {
                span: span!(self, span.lo),
                start: self.input.atom(start),

View on GitHub (pinned to 5176682b65)

Solutions

  1. Remove everything after the wildcard '?' characters
  2. Use explicit 'U+start-end' form instead of combining wildcards with an end value
Defensive patterns

Strategy: validation

When it happens

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