{"record":{"id":"b6b80b898beac843","repo":"amruthpillai/reactive-resume","slug":"unsupported-or-misplaced-combinator","errorCode":null,"errorMessage":"Unsupported or misplaced combinator.","messagePattern":"Unsupported or misplaced combinator\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/resume/src/stylesheet/selector.ts","lineNumber":247,"sourceCode":"\t\t\tthrow new Error(\"Custom class selectors are not supported.\");\n\t\tcase \"PseudoElementSelector\":\n\t\t\tthrow new Error(\"Pseudo-elements are not supported.\");\n\t\tdefault:\n\t\t\tthrow new Error(`Unsupported selector node ${node.type}.`);\n\t}\n}\n\nfunction compileComplex(node: SelectorAst, context: CompileContext): CompiledComplexSelector {\n\tif (node.type !== \"Selector\") throw new Error(\"Expected a Selector AST.\");\n\n\tconst compounds: CompiledCompoundSelector[] = [];\n\tconst combinators: Combinator[] = [];\n\tlet selectors: CompiledSimpleSelector[] = [];\n\tfor (const child of childrenOf(node)) {\n\t\tif (child.type === \"Combinator\") {\n\t\t\tconst name = astName(child) as Combinator;\n\t\t\tif (![\" \", \">\", \"+\", \"~\"].includes(name) || selectors.length === 0) {\n\t\t\t\tthrow new Error(\"Unsupported or misplaced combinator.\");\n\t\t\t}\n\t\t\tvalidateCompound(selectors);\n\t\t\tcompounds.push({ selectors });\n\t\t\tselectors = [];\n\t\t\tcombinators.push(name);\n\t\t\tif (combinators.length > SEMANTIC_CSS_LIMITS_V1.maxCombinatorsPerSelector) {\n\t\t\t\tthrow new Error(\"Selector has too many combinators.\");\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst selector = compileSimple(child, context);\n\t\tif (selector) selectors.push(selector);\n\t}\n\n\tif (selectors.length === 0 && compounds.length > 0) throw new Error(\"Selector cannot end with a combinator.\");\n\tvalidateCompound(selectors);\n\tcompounds.push({ selectors });","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/resume/src/stylesheet/selector.ts#L229-L265","documentation":"Thrown by compileComplex when a combinator child is not one of the four supported combinators (' ', '>', '+', '~'), or when a combinator appears with no preceding simple selector in the current compound (a leading/misplaced combinator). Both conditions make the selector structurally invalid for this compiler.","triggerScenarios":"Writing a selector that starts with a combinator (> section), uses an unsupported combinator token, or has two combinators in a row (section > > item).","commonSituations":"String concatenation that drops the left-hand side; templating that emits a leading '>' or '+'; copy-paste leaving a dangling combinator; css-tree edge cases.","solutions":["Ensure each combinator has a simple selector on both sides: section > item.","Use only the four supported combinators: descendant (space), child (>), next-sibling (+), subsequent-sibling (~).","Trim leading/trailing combinators when generating selectors programmatically."],"exampleFix":"// before\n> section\n// after\nregion > section","handlingStrategy":"validation","validationCode":"const COMBINATORS = new Set([' ', '>', '+', '~']);\nconst noLeadingCombinator = /^[\\s>+~]/.test(selector.trim()) === false;\nconst noDoubleCombinator = !/[\\s>+~]{2,}/.test(selector.replace(' ', ' '));\n// verify both before compiling programmatically built selectors","typeGuard":"const isRejected = (r) => r.selector === null && typeof r.error === 'string';","tryCatchPattern":"const result = compileSelector(selector);\nif (result.selector === null && result.error === 'Unsupported or misplaced combinator.') {\n  trimOrRewriteCombinators(selector);\n}","preventionTips":["Never start a selector with a combinator; always begin with a simple selector.","Use only the four supported combinators: descendant, >, +, ~.","Trim leading/trailing combinators when concatenating selector fragments."],"tags":["semantic-css","selector","combinator","validation"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}