swc-project/swc · error · swc_css_parser::Error

Expected ident (with 'not' value) token

Error message

Expected ident (with 'not' value) token

What it means

Fired while parsing a @supports condition's `not` operand: the parser expected the current token to be the ident `not` (case-insensitive) so it could build a SupportsNot node, but some other token appeared. Input at fault is a @supports prelude where `not` is missing or misspelled, e.g. `@supports display: grid { }` where a negation was required.

Source

Thrown at crates/swc_css_parser/src/parser/at_rules/mod.rs:1039

            conditions,
        })
    }
}

impl<I> Parse<SupportsNot> for Parser<I>
where
    I: ParserInput,
{
    fn parse(&mut self) -> PResult<SupportsNot> {
        let span = self.input.cur_span();
        let keyword = match cur!(self) {
            Token::Ident { value, .. } if value.as_ref().eq_ignore_ascii_case("not") => {
                let ident: Ident = self.parse()?;

                Some(ident)
            }
            _ => {
                return Err(Error::new(
                    span,
                    ErrorKind::Expected("ident (with 'not' value) token"),
                ));
            }
        };

        self.input.skip_ws();

        let supports_in_parens = self.parse()?;

        Ok(SupportsNot {
            span: span!(self, span.lo),
            keyword,
            condition: supports_in_parens,
        })
    }
}

View on GitHub (pinned to 5176682b65)

Solutions

  1. Write `not (...)` with the `not` ident
  2. Report the collected error
  3. Fix the @supports condition syntax
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/swc_css_parser/src/parser/at_rules/mod.rs:1039 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/ec99de8df46d4e5b. Report an issue: GitHub.