denoland/deno · error · Error
Multiple selector arguments not supported here
Error message
Multiple selector arguments not supported here
What it means
Inside the `of <selector>` clause of :nth-child(), the parser sets throwOnComma = true (cli/js/40_lint_selector.js). A comma encountered while that flag is set throws `Multiple selector arguments not supported here` — the An+B-of form accepts exactly one selector argument, unlike :is()/:has()/:not() which take selector lists. The flag stays set until the next closing parenthesis, so any comma between `of` and the ')' that closes the :nth-child throws.
Solutions
- Keep a single selector in the of-clause: ":nth-child(1 of a)".
- List multiple selector keys — top-level comma lists are allowed because visitor keys are split before parsing: "Var:nth-child(1 of a), Var:nth-child(1 of b)".
- Alternatively, match the parent/child relationship in the key and verify the sibling index in JavaScript inside the visitor.
Example fix
// before
"Var:nth-child(1 of A, B)"(node) { /* ... */ },
// after
"Var:nth-child(1 of A), Var:nth-child(1 of B)"(node) { /* ... */ }, Defensive patterns
Strategy: validation
Validate before calling
function checkOfClause(key) {
const m = key.match(/:nth-child\([^)]*\bof\b[^)]*,/);
if (m) {
throw new Error(`Selector list inside 'of' not supported in "${key}"; split into multiple keys`);
}
} Prevention
- Keep exactly one selector inside an of-clause.
- Express alternatives as a top-level comma list in the visitor key — those are split before parsing and are safe.
- Do not try to sneak a list in via :is() inside the of-clause; commas there hit the same guard.
When it happens
Trigger: Visitor keys like "Var:nth-child(1 of a, b)" — a comma-separated selector list inside the of-clause. Note the workaround of nesting (:nth-child(1 of :is(a, b))) also throws for the same reason, because the comma arrives while throwOnComma is still true.
Common situations: Trying to count only among several sibling types at once, CSS-style; extending an existing of-clause with a second selector during iteration.
Related errors
- Expected 'of' keyword in ':nth-child' but got
- Empty node
- Empty selector
- Expected token ' ', but got ' '.\n\n \n ^
- Invalid RegExp pattern
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/ce1eb19acef83f09.
Report an issue: GitHub.
Appendix: 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 9ad36f7a2c)