swc-project/swc · error

Expected no characters after end in unicode range

Error message

Expected no characters after end in unicode range

What it means

Fired during <urange> validation: after consuming the end value's hex digits, additional characters remain in the text. The spec requires the production to end after the end value; trailing content is a parse error.

Source

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

                _ => {
                    break;
                }
            }
        }

        let len = end.len();

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

        if chars.next().is_some() {
            return Err(Error::new(
                span,
                ErrorKind::Expected("no characters after end in unicode range"),
            ));
        }

        return Ok(UnicodeRange {
            span: span!(self, span.lo),
            start: self.input.atom(start),
            end: Some(self.input.atom(end)),
            raw: Some(self.input.atom(unicode_range)),
        });
    }
}

impl<I> Parse<CalcSum> for Parser<I>
where
    I: ParserInput,
{

View on GitHub (pinned to 5176682b65)

Solutions

  1. Remove characters after the end value of the range
  2. Split multiple ranges into comma-separated entries
Defensive patterns

Strategy: validation

When it happens

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