{"record":{"id":"419fc5ea3ed9ea3c","repo":"amruthpillai/reactive-resume","slug":"name-does-not-accept-arguments","errorCode":null,"errorMessage":":${name} does not accept arguments.","messagePattern":":(.+?) does not accept arguments\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/resume/src/stylesheet/selector.ts","lineNumber":206,"sourceCode":"\t\tcase \"AttributeSelector\": {\n\t\t\tconst name = astName(node);\n\t\t\tif (!knownAttributes.has(name)) throw new Error(`Unknown semantic attribute ${name}.`);\n\t\t\tif (node.flags) throw new Error(\"Attribute selector flags are not supported.\");\n\t\t\tconst matcher = node.matcher as AttributeMatcher | null | undefined;\n\t\t\tif (matcher !== null && matcher !== undefined && ![\"=\", \"~=\", \"|=\", \"^=\", \"$=\", \"*=\"].includes(matcher)) {\n\t\t\t\tthrow new Error(`Unsupported attribute matcher ${matcher}.`);\n\t\t\t}\n\t\t\tconst value = attributeValue(node);\n\t\t\tif ((matcher === null || matcher === undefined) !== (value === null)) {\n\t\t\t\tthrow new Error(\"Attribute selector matcher and value must be used together.\");\n\t\t\t}\n\t\t\treturn { type: \"attribute\", name, matcher: matcher ?? null, value };\n\t\t}\n\t\tcase \"PseudoClassSelector\": {\n\t\t\tconst name = astName(node);\n\t\t\tif ([\"root\", \"first-child\", \"last-child\", \"only-child\"].includes(name)) {\n\t\t\t\tif (node.children !== null && node.children !== undefined)\n\t\t\t\t\tthrow new Error(`:${name} does not accept arguments.`);\n\t\t\t\treturn { type: \"pseudo\", name: name as \"root\" | \"first-child\" | \"last-child\" | \"only-child\" };\n\t\t\t}\n\t\t\tif ([\"is\", \"where\", \"not\"].includes(name)) {\n\t\t\t\tif (context.depth >= SEMANTIC_CSS_LIMITS_V1.maxFunctionDepth) {\n\t\t\t\t\tthrow new Error(\"Selector function nesting is too deep.\");\n\t\t\t\t}\n\t\t\t\tconst nested = childrenOf(node);\n\t\t\t\tif (nested.length !== 1 || nested[0]?.type !== \"SelectorList\") {\n\t\t\t\t\tthrow new Error(`:${name} requires a selector list.`);\n\t\t\t\t}\n\t\t\t\tconst selectors = compileSelectorList(nested[0], { depth: context.depth + 1 });\n\t\t\t\treturn { type: \"pseudo\", name: name as \"is\" | \"where\" | \"not\", selectors };\n\t\t\t}\n\t\t\tif (name === \"nth-child\" || name === \"nth-of-type\") {\n\t\t\t\tif (context.depth >= SEMANTIC_CSS_LIMITS_V1.maxFunctionDepth) {\n\t\t\t\t\tthrow new Error(\"Selector function nesting is too deep.\");\n\t\t\t\t}\n\t\t\t\treturn compileNth(node, name, context);","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/resume/src/stylesheet/selector.ts#L188-L224","documentation":"Thrown by compileSimple in the PseudoClassSelector branch when one of the argument-less pseudo-classes (root, first-child, last-child, only-child) is written with children/arguments, e.g. :root(...). These pseudo-classes never accept arguments in this compiler.","triggerScenarios":"Writing :root(something), :first-child(2), :last-child(...), or :only-child(...).","commonSituations":"Confusing :first-child with :nth-child; copy-pasting functional pseudo-class syntax onto structural ones; editor auto-completion adding parentheses.","solutions":["Drop the argument list: :root, :first-child, :last-child, :only-child.","If you need a positional index, use :nth-child(<expr>) instead of :first-child(<expr>)."],"exampleFix":"// before\nsection:first-child(2)\n// after\nsection:first-child","handlingStrategy":"validation","validationCode":"const ARGLESS = new Set(['root', 'first-child', 'last-child', 'only-child']);\nconst arglessHasNoArgs = (name, hasChildren) => !(ARGLESS.has(name) && hasChildren);\n// reject :root(...)/:first-child(...) forms before compiling","typeGuard":"const isRejected = (r) => r.selector === null && typeof r.error === 'string';","tryCatchPattern":"const result = compileSelector(selector);\nif (result.selector === null && result.error.endsWith(' does not accept arguments.')) {\n  stripArguments(selector);\n}","preventionTips":["Never add parentheses to :root, :first-child, :last-child, :only-child.","Use :nth-child(<expr>) when a positional argument is needed.","Watch for editor auto-completion that appends '()'."],"tags":["semantic-css","selector","pseudo-class","validation"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}