swc-project/swc · error · Error

Expected ',' delim token

Error message

Expected ',' delim token

What it means

Fired while parsing a 'clamp()' function: after the first calc-sum argument, the required ',' separator between the minimum and preferred value was not found. clamp() needs three comma-separated arguments, so the parser reports the missing delimiter.

Source

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

                }
            }
            "clamp" => {
                self.input.skip_ws();

                let calc_sum = ComponentValue::CalcSum(self.parse()?);

                values.push(calc_sum);

                self.input.skip_ws();

                if is!(self, ",") {
                    values.push(ComponentValue::Delimiter(self.parse()?));

                    self.input.skip_ws();
                } else {
                    let span = self.input.cur_span();

                    return Err(Error::new(span, ErrorKind::Expected("',' delim token")));
                }

                let calc_sum = ComponentValue::CalcSum(self.parse()?);

                values.push(calc_sum);

                self.input.skip_ws();

                if is!(self, ",") {
                    values.push(ComponentValue::Delimiter(self.parse()?));

                    self.input.skip_ws();
                } else {
                    let span = self.input.cur_span();

                    return Err(Error::new(span, ErrorKind::Expected("',' delim token")));
                }

View on GitHub (pinned to 5176682b65)

Solutions

  1. Separate the three clamp() arguments with commas: 'clamp(min, val, max)'
  2. Remove extra content if fewer than three arguments were intended and use min()/max() instead
Defensive patterns

Strategy: validation

When it happens

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