{"record":{"id":"c97e09cfacbbeae3","repo":"dotnet/runtime","slug":"no-such-ctf-intrinsic-called-ctf-type","errorCode":null,"errorMessage":"no such ctf intrinsic called: {ctf_type}","messagePattern":"no such ctf intrinsic called: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/genLttngProvider.py","lineNumber":216,"sourceCode":"            if fnparam.prop:\n                #this is an explicit struct treat as a sequence\n                ctf_type = \"ctf_sequence\"\n                sizeofseq = fnparam.prop\n                field_body = \", \".join((typewName, varname, varname, \"size_t\", sizeofseq))\n\n            else:\n                ctf_type = ctfDataTypeMapping[wintypeName]\n                if ctf_type == \"ctf_string\":\n                    field_body = \", \".join((varname, varname))\n\n                elif ctf_type == \"ctf_integer\" or ctf_type == \"ctf_float\":\n                    field_body = \", \".join((typewName, varname, varname))\n\n                elif ctf_type == \"ctf_sequence\":\n                    raise Exception(\"ctf_sequence needs to have its memory expilicitly laid out\")\n\n                else:\n                    raise Exception(\"no such ctf intrinsic called: \" +  ctf_type)\n\n            field_list.append(\"        %s(%s)\" % (ctf_type, field_body))\n\n        field_list = \"\\n\".join(field_list)\n\n    return header + field_list + footer\n\ndef generateLttngHeader(providerName, allTemplates, eventNodes, runtimeFlavor):\n    lTTngHdr = []\n    for templateName in allTemplates:\n        template = allTemplates[templateName]\n        fnSig   = allTemplates[templateName].signature\n\n        lTTngHdr.append(\"\\n#define \" + templateName + \"_TRACEPOINT_ARGS \\\\\\n\")\n\n#TP_ARGS\n        tp_args = generateArgList(template, runtimeFlavor)\n        lTTngHdr.append(tp_args)","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/scripts/genLttngProvider.py#L198-L234","documentation":"Thrown by generateFieldList() in the LTTng provider code generator when a Windows ETW manifest data type maps to a CTF (Common Trace Format) intrinsic that has no code-generation case in the if/elif chain. The generator looks up the CTF type from ctfDataTypeMapping and must emit a matching field body for ctf_string, ctf_integer/ctf_float, or ctf_sequence; reaching the final else means a new or unexpected CTF type was encountered that the generator was never taught to handle.","triggerScenarios":"Called during generateLttngHeader() -> generateFieldList() when iterating template parameters whose fnparam.prop is falsy (non-struct). The ctf_type resolved from ctfDataTypeMapping[wintypeName] does not match 'ctf_string', 'ctf_integer', 'ctf_float', or 'ctf_sequence'. This happens if the ctfDataTypeMapping dictionary is extended with a new CTF intrinsic value but the if/elif chain at lines 206-216 is not updated to emit a field_body for it.","commonSituations":"A developer adds a new win:* type to ctfDataTypeMapping (e.g., a hypothetical 'ctf_enum') without adding a corresponding branch in generateFieldList. Alternatively, a manifest introduces a data type that, through the mapping chain, resolves to an unhandled CTF category. This is a build-time code-generation failure, not a runtime error in production tracing.","solutions":["Add an elif branch in generateFieldList (after line 213) that handles the new ctf_type value and constructs an appropriate field_body string.","If the type should not be a sequence, verify that the ctfDataTypeMapping entry for the offending win:* type is correct and maps to a supported intrinsic (ctf_integer, ctf_float, ctf_string, or ctf_sequence).","Run the generator with --dry-run to identify which template/parameter triggers the error before it raises, then inspect the manifest for the offending win:* type."],"exampleFix":"// before (genLttngProvider.py, ctfDataTypeMapping extended but no handler)\nctfDataTypeMapping[\"win:MyNewType\"] = \"ctf_enum\"\n// ... generateFieldList hits else branch -> Exception\n\n# after: add a handler branch\nelif ctf_type == \"ctf_enum\":\n    field_body = \", \".join((typewName, varname, varname))","handlingStrategy":"validation","validationCode":"# Before calling generateFieldList, validate that all CTF types are handled\nvalid_ctf_types = {'ctf_string', 'ctf_integer', 'ctf_float', 'ctf_sequence'}\nfor template_name, template in allTemplates.items():\n    fnSig = template.signature\n    for params in fnSig.paramlist:\n        fnparam = fnSig.getParam(params)\n        if not fnparam.prop:\n            ctf_type = ctfDataTypeMapping.get(fnparam.winType)\n            if ctf_type and ctf_type not in valid_ctf_types:\n                print(f\"WARNING: unhandled ctf_type '{ctf_type}' for win:{fnparam.winType} in template {template_name}\")","typeGuard":"def is_supported_ctf_type(ctf_type: str) -> bool:\n    supported = {'ctf_string', 'ctf_integer', 'ctf_float', 'ctf_sequence'}\n    return ctf_type in supported","tryCatchPattern":"# This is a build-time code generator; failures should surface immediately.\n# No try-catch needed — let the exception propagate to halt the build with context.","preventionTips":["When adding a new entry to ctfDataTypeMapping, always add a corresponding branch in generateFieldList's if/elif chain.","Use a code review checklist that verifies ctfDataTypeMapping keys have matching handlers in generateFieldList.","Run the generator with --dry-run after manifest changes to catch errors before file generation."],"tags":["code-generation","lttng","tracing","build-time","manifest"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}