denoland/deno · error · Error

Multiple selector arguments not supported here

Error message

Multiple selector arguments not supported here

What it means

Thrown by the selector parser (cli/js/40_lint_selector.js) when a comma appears while throwOnComma is set — i.e. inside the 'of <selector>' argument of :nth-child(). After 'N of S' begins, the argument is a single selector; a comma-separated list is not accepted there, unlike :has()/:is()/:not() which do accept lists.

Source

Thrown at cli/js/40_lint_selector.js:729

        case "not": {
          lex.next();
          lex.expect(Token.BraceOpen);
          lex.next();

          current.push({
            type: PSEUDO_NOT,
            selectors: [],
          });
          stack.push([]);

          continue;
        }
        default:
          throw new Error(`Unknown pseudo selector: '${lex.value}'`);
      }
    } else if (lex.token === Token.Comma) {
      if (throwOnComma) {
        throw new Error(`Multiple selector arguments not supported here`);
      }

      lex.next();
      if (lex.token === Token.Space) {
        lex.next();
      }

      popSelector(result, stack);
      stack.push([]);
      continue;
    } else if (lex.token === Token.BraceClose) {
      throwOnComma = false;
      popSelector(result, stack);
    } else if (lex.token === Token.Op) {
      current.push({
        type: RELATION_NODE,
        op: getAttrOp(lex.value),
      });

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Wrap the list in :is(): :nth-child(1 of :is(A, B))
  2. Or register one :nth-child selector per node type and merge the logic in the visitor

Example fix

// before
":nth-child(1 of VariableDeclarator, CallExpression)"(node) {},

// after
":nth-child(1 of :is(VariableDeclarator, CallExpression))"(node) {},
Defensive patterns

Strategy: validation

Validate before calling

function nthChildOfIsSingle(sel) {
  const m = sel.match(/:nth-child\(\s*\d+\s+of\s+([^()]*)\)/);
  if (m && m[1].includes(",")) {
    throw new Error("wrap the 'of' list in :is(): " + sel);
  }
}

Prevention

When it happens

Trigger: A selector like ":nth-child(1 of VariableDeclarator, CallExpression)" — the comma after the 'of' selector triggers the throw.throwOnComma path.

Common situations: Trying to count the nth occurrence across several node types at once; porting a CSS/Eslint selector that combined :nth-child with a selector list.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/ce1eb19acef83f09. Report an issue: GitHub.