{"record":{"id":"126cbc8566995a0b","repo":"dotnet/runtime","slug":"unknown-attribute-in-template","errorCode":null,"errorMessage":"unknown attribute: {} in template:{}","messagePattern":"unknown attribute: (.+?) in template:(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/genEventing.py","lineNumber":353,"sourceCode":"\n    #return values\n    allTemplates           = {}\n\n    for templateNode in templateNodes:\n        structCounts = {}\n        arrays = {}\n        templateName    = templateNode.getAttribute('tid')\n        var_Dependencies = {}\n        fnPrototypes    = FunctionSignature()\n        dataNodes       = getTopLevelElementsByTagName(templateNode,'data')\n\n        # Validate that no new attributes has been added to manifest\n        for dataNode in dataNodes:\n            nodeMap = dataNode.attributes\n            for attrib in nodeMap.values():\n                attrib_name = attrib.name\n                if attrib_name not in ignoredXmlTemplateAttribes and attrib_name not in usedXmlTemplateAttribes:\n                    raise ValueError('unknown attribute: '+ attrib_name + ' in template:'+ templateName)\n\n        for dataNode in dataNodes:\n            variable = dataNode.getAttribute('name')\n            wintype = dataNode.getAttribute('inType')\n\n            #count and length are the same\n            wincount  = dataNode.getAttribute('count')\n            winlength = dataNode.getAttribute('length');\n\n            var_Props = None\n            var_dependency = [variable]\n            if  winlength:\n                if wincount:\n                    raise Exception(\"both count and length property found on: \" + variable + \"in template: \" + templateName)\n                wincount = winlength\n\n            if (wincount.isdigit() and int(wincount) ==1):\n                wincount = ''","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/genEventing.py#L335-L371","documentation":"Raised by parseTemplateNodes() in genEventing.py when a <data> element inside a <template> in the ETW manifest has an XML attribute that is not in the set of recognized attributes. Recognized attributes are: name, inType, count, length (used), and map, outType (ignored). Any other attribute triggers a ValueError.","triggerScenarios":"Triggered when iterating over dataNode.attributes for each <data> element in a template, and an attribute name is found that is not in ignoredXmlTemplateAttribes (frozenset ['map','outType']) nor usedXmlTemplateAttribes (frozenset ['name','inType','count','length']). This is a schema validation guard to catch manifest changes that introduce attributes the code generator doesn't understand.","commonSituations":"A developer adds a new attribute to a <data> element in ClrEtwAll.man (e.g., 'length2', 'scale', 'display', etc.) that the code generator hasn't been taught about. A manifest editing tool auto-inserts unexpected attributes. The manifest schema was extended but genEventing.py wasn't updated to handle or explicitly ignore the new attribute.","solutions":["Identify the unexpected attribute from the error message (it includes the attribute name and template tid).","If the attribute is intentional, add it to ignoredXmlTemplateAttribes or usedXmlTemplateAttribes in genEventing.py and handle it in the parsing logic.","If the attribute is accidental, remove it from the <data> element in the manifest.","Ensure the manifest complies with the ETW manifest schema expected by the code generator."],"exampleFix":"# before\nignoredXmlTemplateAttribes = frozenset([\"map\",\"outType\"])\nusedXmlTemplateAttribes    = frozenset([\"name\",\"inType\",\"count\", \"length\"])\n\n# after - add the new attribute to the ignored set if it's metadata-only\nignoredXmlTemplateAttribes = frozenset([\"map\",\"outType\",\"length2\"])\nusedXmlTemplateAttribes    = frozenset([\"name\",\"inType\",\"count\", \"length\"])","handlingStrategy":"validation","validationCode":"ALLOWED_DATA_ATTRS = frozenset([\"name\", \"inType\", \"count\", \"length\", \"map\", \"outType\"])\n\ndef validate_template_attributes(manifest_path: str) -> list:\n    \"\"\"Return list of unknown attributes found in template data elements.\"\"\"\n    import xml.dom.minidom as DOM\n    tree = DOM.parse(manifest_path)\n    issues = []\n    for template in tree.getElementsByTagName('template'):\n        tid = template.getAttribute('tid')\n        for data in template.getElementsByTagName('data'):\n            for attr in data.attributes.values():\n                if attr.name not in ALLOWED_DATA_ATTRS:\n                    issues.append(f\"Unknown attr '{attr.name}' on data '{data.getAttribute('name')}' in template '{tid}'\")\n    return issues","typeGuard":"null","tryCatchPattern":"try:\n    allTemplates = parseTemplateNodes(templateNodes)\nexcept ValueError as e:\n    if 'unknown attribute' in str(e):\n        print(f\"Manifest schema error: {e}\")\n        print(\"Either remove the attribute or add it to ignoredXmlTemplateAttribes/usedXmlTemplateAttribes.\")\n    raise","preventionTips":["Validate manifest <data> attributes against the known set before generation.","When adding new manifest attributes, update both frozensets in genEventing.py.","Use an XML schema validator on the manifest before running the generator.","Document which attributes are recognized vs. ignored for manifest authors."],"tags":["etw","manifest","eventing","coreclr","schema-validation"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}