{"record":{"id":"90f2be82ff48b544","repo":"amruthpillai/reactive-resume","slug":"attribute-value-is-missing","errorCode":null,"errorMessage":"Attribute value is missing.","messagePattern":"Attribute value is missing\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/resume/src/stylesheet/selector.ts","lineNumber":100,"sourceCode":"function 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);\n\t\treturn tokens.length > 0 && tokens.every((token) => roles.has(token));\n\t}\n\n\treturn [...roles].some((role) => matchesAttribute(role, matcher, value));\n}\n\nfunction validateCompound(selectors: readonly CompiledSimpleSelector[]): void {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/resume/src/stylesheet/selector.ts#L82-L118","documentation":"attributeValue extracts the value of a csstree attribute selector node. It returns node.value.value when it's a string, or identifier(node.value.name) for the identifier shape; if node.value exists but neither field is a usable string, it throws 'Attribute value is missing.' Reached only when node.value is truthy (otherwise it returns null earlier).","triggerScenarios":"An attribute selector whose value is a non-string, non-identifier AST shape, e.g. [role=] with no value, or [x=123] encoded in a way csstree represents as a numeric/raw node; a malformed [attr=val] construct.","commonSituations":"User typed an attribute selector with a missing or unquoted complex value; csstree representation differs from the two handled shapes after a library bump; an AI-generated selector with broken attribute syntax.","solutions":["Quote or correct the attribute value: [role='section'] instead of [role=].","If the value is meant to be empty, remove the attribute selector; attribute matching requires a value here.","Add a test fixture of the failing selector and confirm the AST shape against the handled branches; extend attributeValue if a legitimate shape appears.","Pin csstree to the version the mapper targets."],"exampleFix":"/* before: missing value */\n[role=] { ... }\n/* after */\n[role='section'] { ... }","handlingStrategy":"try-catch","validationCode":"import { parse } from 'css-tree';\ntry { parse(selector, { context: 'selector' }); } catch { throw new Error('Invalid attribute selector'); }","typeGuard":"function hasAttributeValue(node: any): boolean {\n  return !node.value || typeof node.value.value === 'string' || typeof node.value.name === 'string';\n}","tryCatchPattern":"try { compileSelector(selector); }\ncatch (e) { if (/Attribute value is missing/.test(String((e as Error).message))) { reportInvalidSelector(selector); return; } throw e; }","preventionTips":["Quote attribute values: [role='section'].","Remove attribute selectors with no value.","Pin csstree; add fixtures for any new value shape."],"tags":["stylesheet","css","csstree","selector","attribute","parser"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}