{"record":{"id":"92d9b7bb007e399b","repo":"amruthpillai/reactive-resume","slug":"selector-name-is-missing","errorCode":null,"errorMessage":"Selector name is missing.","messagePattern":"Selector name is missing\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/resume/src/stylesheet/selector.ts","lineNumber":93,"sourceCode":"const knownAttributes = new Set([\n\t\"id\",\n\t\"role\",\n\t...Object.values(SEMANTIC_REGISTRY_V1).flatMap((definition) => definition.attributes),\n]);\nconst knownRoles = new Set(Object.values(SEMANTIC_REGISTRY_V1).flatMap((definition) => definition.roles));\n\nfunction childrenOf(node: SelectorAst): SelectorAst[] {\n\treturn node.children ? [...node.children] : [];\n}\n\nfunction identifier(value: string): string {\n\treturn csstree.ident.decode(value);\n}\n\nfunction astName(node: SelectorAst): string {\n\tif (typeof node.name === \"string\") return identifier(node.name);\n\tif (node.name && typeof node.name.name === \"string\") return identifier(node.name.name);\n\tthrow new Error(\"Selector name is missing.\");\n}\n\nfunction attributeValue(node: SelectorAst): string | null {\n\tif (!node.value) return null;\n\tif (typeof node.value.value === \"string\") return node.value.value;\n\tif (typeof node.value.name === \"string\") return identifier(node.value.name);\n\tthrow new Error(\"Attribute value is missing.\");\n}\n\nfunction allowedRoles(type: SemanticNode[\"kind\"] | null): ReadonlySet<string> {\n\treturn type ? new Set(SEMANTIC_REGISTRY_V1[type].roles) : knownRoles;\n}\n\nfunction roleValueIsKnown(matcher: AttributeMatcher | null, value: string | null, roles: ReadonlySet<string>): boolean {\n\tif (!matcher || value === null) return roles.size > 0;\n\tif (matcher === \"~=\") return roles.has(value);\n\tif (matcher === \"=\") {\n\t\tconst tokens = value.split(/\\s+/).filter(Boolean);","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/resume/src/stylesheet/selector.ts#L75-L111","documentation":"astName reads the name of a csstree SelectorAst node. It returns identifier(node.name) when name is a string, or identifier(node.name.name) for the {name:{name}} shape; if neither holds it throws 'Selector name is missing.' This indicates an AST node the selector compiler expected to have a name (type/pseudo-class/attribute identifier) arrived without one.","triggerScenarios":"A user-authored or AI-generated selector that csstree parsed into an unexpected node shape; a selector containing a bare punctuation construct that yields a nameless node; a csstree version change altering AST node shapes.","commonSituations":"Editing the semantic stylesheet with a malformed selector (e.g. ':' alone, '::' bare, or a pseudo with no name); upgrading csstree without updating the mapper; a selector with non-ASCII/control characters that parse oddly.","solutions":["Simplify the offending selector to standard form (every type/pseudo/attribute needs a name token).","Run the selector through csstreefork/use-parse in a scratch test to find which node lacks a name.","Pin or align the csstree version with what the mapper was written against.","Report the failing selector to the user with a clear 'invalid selector' message rather than crashing."],"exampleFix":"/* before: bare pseudo, nameless node */\nselector { :: {} }\n/* after */\nselector { ::after {} }","handlingStrategy":"try-catch","validationCode":"import { parse } from 'css-tree';\ntry { parse(selector, { context: 'selector' }); } catch { throw new Error('Invalid selector syntax'); }","typeGuard":"function hasName(node: any): boolean {\n  return typeof node?.name === 'string' || typeof node?.name?.name === 'string';\n}","tryCatchPattern":"try { compileSelector(selector); }\ncatch (e) { if (/Selector name is missing/.test(String((e as Error).message))) { reportInvalidSelector(selector); return; } throw e; }","preventionTips":["Sanitize user/AI selectors through csstree parse before compiling.","Pin the csstree version the mapper targets.","Show a clear 'invalid selector' message instead of crashing."],"tags":["stylesheet","css","csstree","selector","parser"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}