{"record":{"id":"1a0f2b4a47e408b1","repo":"dotnet/runtime","slug":"tool-tool-name-not-found-have-you-built-the-run","errorCode":null,"errorMessage":"Tool {tool_name} not found. Have you built the runtime repo and created a Core_Root, or put it on your PATH?","messagePattern":"Tool (.+?) not found\\. Have you built the runtime repo and created a Core_Root, or put it on your PATH\\?","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/superpmi.py","lineNumber":3882,"sourceCode":"    # Next, look in the built product directory, if it exists. We can use superpmi/mcs directly from the\n    # product build directory instead from Core_Root because they don't depend on managed code libraries.\n    if search_product_location and hasattr(coreclr_args, \"product_location\") and coreclr_args.product_location is not None and os.path.isdir(coreclr_args.product_location):\n        tool_path = os.path.join(coreclr_args.product_location, tool_name)\n        if os.path.isfile(tool_path):\n            logging.debug(\"Using %s from product build location: %s\", tool_name, tool_path)\n            return tool_path\n\n    # Finally, look on the PATH\n    if search_path:\n        path_var = os.environ.get(\"PATH\")\n        if path_var is not None:\n            tool_path = find_file(tool_name, path_var.split(os.pathsep))\n            if tool_path is not None:\n                logging.debug(\"Using %s from PATH: %s\", tool_name, tool_path)\n                return tool_path\n\n    if throw_on_not_found:\n        raise RuntimeError(\"Tool \" + tool_name + \" not found. Have you built the runtime repo and created a Core_Root, or put it on your PATH?\")\n\n    return None\n\n\ndef determine_superpmi_tool_name(coreclr_args):\n    \"\"\" Determine the superpmi tool name based on the OS\n\n    Args:\n        coreclr_args (CoreclrArguments): parsed args\n\n    Return:\n        (str) Name of the superpmi tool to use\n    \"\"\"\n\n    if coreclr_args.host_os == \"osx\" or coreclr_args.host_os == \"linux\":\n        return \"superpmi\"\n    elif coreclr_args.host_os == \"windows\":\n        return \"superpmi.exe\"","sourceCodeStart":3864,"sourceCodeEnd":3900,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/superpmi.py#L3864-L3900","documentation":"Raised by find_tool after exhausting all search locations (Core_Root, product build directory, PATH) for a required tool binary such as superpmi, mcs, clrjit, or dotnet. The message guides the developer to build the runtime repo and create a Core_Root or place the tool on PATH. This is the most common startup failure for SuperPMI workflows.","triggerScenarios":"find_tool(coreclr_args, tool_name, ...) is called for tools like superpmi/superpmi.exe, mcs/mcs.exe, clrjit.dll, or dotnet; none of Core_Root, product_location, or PATH contain the file, and throw_on_not_found is True (default). Common when the runtime has not been built, when Core_Root was not created, or when jitutils tools are not on PATH.","commonSituations":"First run on a fresh clone without building; building only part of the product so Core_Root is incomplete; forgetting to build jitutils and add its bin to PATH; mismatched build_type/arch so the expected tool name isn't where expected.","solutions":["Build the runtime: run the repo build script (build.cmd/build.sh) for coreclr and create a Core_Root; then re-run superpmi.py.","If the tool is from jitutils (superpmi, mcs), build https://github.com/dotnet/jitutils and add its bin directory to PATH.","Pass --core_root <path> and/or --product_location <path> explicitly to point at your built output.","Confirm the tool filename matches your OS (e.g. superpmi.exe on Windows vs superpmi on Linux) and your build_type/arch."],"exampleFix":"// before\nif throw_on_not_found:\n    raise RuntimeError(\"Tool \" + tool_name + \" not found. Have you built the runtime repo and created a Core_Root, or put it on your PATH?\")\n// after (fix invocation, not code)\n# Build runtime and create Core_Root, then:\npython superpmi.py <mode> --core_root <path-to-Core_Root>\n# Or install jitutils and add to PATH:\n#   build jitutils, then `export PATH=$PATH:<jitutils>/bin`","handlingStrategy":"validation","validationCode":"import os\ndef preflight_tool(coreclr_args, tool_name):\n    locations = []\n    if hasattr(coreclr_args, 'core_root') and coreclr_args.core_root:\n        locations.append(os.path.join(coreclr_args.core_root, tool_name))\n    if hasattr(coreclr_args, 'product_location') and coreclr_args.product_location:\n        locations.append(os.path.join(coreclr_args.product_location, tool_name))\n    found = [p for p in locations if os.path.isfile(p)]\n    if not found:\n        raise RuntimeError(f\"{tool_name} not found in Core_Root or product_location. Build the runtime (and jitutils for superpmi/mcs), then pass --core_root or add the bin dir to PATH.\")\n    return found[0]","typeGuard":null,"tryCatchPattern":"try:\n    tool_path = find_tool(coreclr_args, tool_name)\nexcept RuntimeError as e:\n    logging.error(str(e))\n    logging.error('Build steps: runtime -> Core_Root; jitutils -> add bin to PATH')\n    raise","preventionTips":["Build the runtime repo and create a Core_Root before running SuperPMI.","Build jitutils (https://github.com/dotnet/jitutils) and add its bin to PATH for superpmi/mcs.","Pass --core_root and/or --product_location explicitly in CI to avoid PATH reliance."],"tags":["tool-resolution","core-root","path","build","superpmi"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}