{"record":{"id":"ee8f31e3c4ed76a7","repo":"amruthpillai/reactive-resume","slug":"attribute-selector-name-is-not-available-on-t","errorCode":null,"errorMessage":"Attribute ${selector.name} is not available on ${type}.","messagePattern":"Attribute (.+?) is not available on (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/resume/src/stylesheet/selector.ts","lineNumber":137,"sourceCode":"\tconst types = selectors.filter(\n\t\t(selector): selector is Extract<CompiledSimpleSelector, { type: \"type\" }> => selector.type === \"type\",\n\t);\n\tif (types.length > 1) throw new Error(\"A compound selector can contain only one type selector.\");\n\n\tconst type = types[0]?.name ?? null;\n\tfor (const selector of selectors) {\n\t\tif (selector.type !== \"attribute\") continue;\n\n\t\tif (selector.name === \"id\") continue;\n\t\tif (selector.name === \"role\") {\n\t\t\tif (!roleValueIsKnown(selector.matcher, selector.value, allowedRoles(type))) {\n\t\t\t\tthrow new Error(\"Selector uses an unknown role.\");\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (type && !(SEMANTIC_REGISTRY_V1[type].attributes as readonly string[]).includes(selector.name)) {\n\t\t\tthrow new Error(`Attribute ${selector.name} is not available on ${type}.`);\n\t\t}\n\t}\n}\n\nfunction compileNth(\n\tnode: SelectorAst,\n\tname: \"nth-child\" | \"nth-of-type\",\n\tcontext: CompileContext,\n): CompiledSimpleSelector {\n\tconst nth = childrenOf(node);\n\tif (nth.length !== 1 || nth[0]?.type !== \"Nth\" || !nth[0].nth) {\n\t\tthrow new Error(`:${name} requires one An+B expression.`);\n\t}\n\n\tconst expression = nth[0].nth;\n\tlet a = 0;\n\tlet b = 0;\n\tif (expression.type === \"Identifier\") {","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/resume/src/stylesheet/selector.ts#L119-L155","documentation":"Thrown by validateCompound when an attribute selector uses a globally-recognized attribute name that is not declared on the specific semantic element type present in the same compound. Each kind in SEMANTIC_REGISTRY_V1 owns its own attributes array; 'id' and 'role' are exempted because they apply to all kinds.","triggerScenarios":"Writing page[type] (type belongs to section), resume[placement] (placement belongs to region/section), or section[page-number] where the attribute belongs to a different kind.","commonSituations":"Assuming an attribute is universal because it works elsewhere; refactoring a selector from one element kind to another without re-checking that kind's attribute list; auto-complete suggesting attributes from a different type.","solutions":["Open SEMANTIC_REGISTRY_V1[<your-type>] and confirm the attribute is in its attributes array.","Move the attribute selector onto the element kind that actually declares it.","Remove the attribute selector if it is not meaningful for that type."],"exampleFix":"// before\npage[type='experience']\n// after\nsection[type='experience']","handlingStrategy":"validation","validationCode":"import { SEMANTIC_REGISTRY_V1 } from '@reactive-resume/resume';\n\nconst attributeAllowedOn = (type, attr) =>\n  attr === 'id' || attr === 'role' ||\n  (SEMANTIC_REGISTRY_V1[type]?.attributes ?? []).includes(attr);\n// call before combining a type selector with an attribute selector","typeGuard":"const isRejected = (r) => r.selector === null && typeof r.error === 'string';","tryCatchPattern":"const result = compileSelector(selector);\nif (result.selector === null) {\n  // result.error starts with 'Attribute' and ends with 'is not available on ...'\n  reportToSelectorAuthor(result.error, selector);\n}","preventionTips":["When moving a selector between element kinds, re-check the target kind's attributes array.","Only id and role are universal; every other attribute is type-scoped.","Lint selectors against SEMANTIC_REGISTRY_V1 in CI."],"tags":["semantic-css","selector","attribute","validation"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}