{"record":{"id":"2f94f51aabafd71b","repo":"NationalSecurityAgency/ghidra","slug":"toolchain-type-toolchain-type-s-not-known","errorCode":null,"errorMessage":"Toolchain type %(toolchain_type)s not known","messagePattern":"Toolchain type (.+?) not known","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Ghidra/Extensions/SleighDevTools/pcodetest/pcodetest.py","lineNumber":81,"sourceCode":"\nclass PCodeTestBuild(BuildUtil):\n    def __init__(self, pcode_test):\n        super(PCodeTestBuild, self).__init__()\n        self.config = Config(pcode_test.config)\n        self.config.cwd = self.getcwd()\n\n    @classmethod\n    def factory(cls, pcode_test):\n        if pcode_test.config.toolchain_type == 'gcc':\n            return PCodeBuildGCC(pcode_test)\n        elif pcode_test.config.toolchain_type == 'ccs':\n            return PCodeBuildCCS(pcode_test)\n        elif pcode_test.config.toolchain_type == 'sdcc':\n            return PCodeBuildSDCC(pcode_test)\n        elif pcode_test.config.toolchain_type == 'llvm':\n            return PCodeBuildLLVM(pcode_test)\n        else:\n            raise Exception(pcode_test.config.format('Toolchain type %(toolchain_type)s not known'))\n\n    def which(self, what):\n        return self.config.format('%(toolchain_dir)s/%(' + what + ')s')\n\n    def compile(self, input_files, opt_cflag, output_base):\n        self.log_err(self.config.format('compile not implemented for %(toolchain_type)s'))\n\n    # generic build a single PCodeTest for all variants\n    def main(self):\n\n        # make sure compiler exists and runnable\n        self.config.compile_exe = self.config.exec_dir + self.config.exec_prefix + self.config.compile_exe\n        self.config.strip_exe = self.config.exec_dir + str(self.config.exec_prefix) + str(self.config.strip_exe)\n        self.config.objdump_exe = self.config.exec_dir + str(self.config.exec_prefix) + str(self.config.objdump_exe)\n        self.config.readelf_exe = self.config.exec_dir + str(self.config.exec_prefix) + str(self.config.readelf_exe)\n        self.config.nm_exe = self.config.exec_dir + str(self.config.exec_prefix) + str(self.config.nm_exe)\n        \n        if not self.is_executable_file(self.which('compile_exe')):","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Extensions/SleighDevTools/pcodetest/pcodetest.py#L63-L99","documentation":"Raised by PCodeTestBuild.factory() in pcodetest.py when config.toolchain_type is not one of the recognized values ('gcc','ccs','sdcc','llvm'). The factory dispatches on toolchain_type to pick the right compiler wrapper; an unknown value means no build strategy exists. The message is produced via config.format() so %(toolchain_type)s is interpolated with the offending value.","triggerScenarios":"PCodeTestBuild.factory(pcode_test) where pcode_test.config.toolchain_type is misspelled (e.g. 'GCC', 'clang', 'arm-gcc') or unset; a test config (.pspec/.cfg) declares an unsupported toolchain.","commonSituations":"Adding a new target whose toolchain_type doesn't match the four known strings; typo in the YAML/JSON test descriptor; case mismatch ('GCC' vs 'gcc'); a toolchain type the build harness was never extended to support.","solutions":["Set toolchain_type to one of 'gcc', 'ccs', 'sdcc', 'llvm' (lowercase, exact).","If you genuinely need a new toolchain, add a PCodeBuild subclass and a factory branch for it before using the type.","Check the test config file (the descriptor feeding pcode_test.config) for the typo and re-run."],"exampleFix":"# before\ntoolchain_type: GCC   # case mismatch -> raises\n\n# after\ntoolchain_type: gcc","handlingStrategy":"validation","validationCode":"KNOWN = {'gcc', 'ccs', 'sdcc', 'llvm'}\ntt = pcode_test.config.toolchain_type\nif tt not in KNOWN:\n    raise ValueError(f\"unsupported toolchain_type {tt!r}; must be one of {sorted(KNOWN)}\")\nPCodeTestBuild.factory(pcode_test)","typeGuard":"def is_known_toolchain(tt: str) -> bool:\n    return tt in {'gcc', 'ccs', 'sdcc', 'llvm'}","tryCatchPattern":"try:\n    builder = PCodeTestBuild.factory(pcode_test)\nexcept Exception as e:\n    if 'Toolchain type' in str(e):\n        # fix toolchain_type in the test descriptor and re-run\n        pass\n    else:\n        raise","preventionTips":["Use lowercase exact values 'gcc','ccs','sdcc','llvm' for toolchain_type.","Validate toolchain_type against the known set in your test descriptor schema.","Extend the factory (add a subclass + branch) before introducing a new type."],"tags":["sleigh-devtools","pcodetest","build-config","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}