{"record":{"id":"0e7387e52bca558d","repo":"dotnet/runtime","slug":"mch-file-failed-to-be-generated-at-s","errorCode":null,"errorMessage":"MCH file failed to be generated at: %s","messagePattern":"MCH file failed to be generated at: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/superpmi.py","lineNumber":1368,"sourceCode":"            raise RuntimeError(\"No .mc files generated.\")\n\n    def __merge_mc_files__(self):\n        \"\"\" Merge the mc files that were generated\n\n        Notes:\n            mcs -merge <s_baseMchFile> <s_tempDir>\\\\*.mc -recursive -dedup -thin\n\n        \"\"\"\n\n        logging.info(\"Merging MC files\")\n\n        pattern = os.path.join(self.temp_location, \"*.mc\")\n\n        command = [self.mcs_path, \"-merge\", self.base_mch_file, pattern, \"-recursive\", \"-dedup\", \"-thin\"]\n        run_and_log(command)\n\n        if not os.path.isfile(self.base_mch_file):\n            raise RuntimeError(\"MCH file failed to be generated at: %s\" % self.base_mch_file)\n\n        # All the individual MC files are no longer necessary, now that we have\n        # merged them into the base.mch. Delete them.\n        if not self.coreclr_args.skip_cleanup:\n            mc_files = [os.path.join(self.temp_location, item) for item in os.listdir(self.temp_location) if item.endswith(\".mc\")]\n            for item in mc_files:\n                os.remove(item)\n\n    def __merge_mch_files__(self):\n        \"\"\" Merge MCH files in the mch_files list. This is only used with the `--merge_mch_files` argument.\n\n        Notes:\n            mcs -concat <s_baseMchFile> [self.coreclr_args.mch_files]\n\n        \"\"\"\n\n        logging.info(\"Merging MCH files\")\n","sourceCodeStart":1350,"sourceCodeEnd":1386,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/superpmi.py#L1350-L1386","documentation":"Raised by SuperPMICollect.__merge_mc_files__ in superpmi.py after invoking `mcs -merge ... *.mc`. It checks os.path.isfile(self.base_mch_file) (the 'base.mch' output of mcs); if mcs failed to produce it, the merge did not succeed and downstream steps cannot run.","triggerScenarios":"The `mcs -merge -recursive -dedup -thin base.mch *.mc` command failed (non-zero, crashed, or wrote no output), so base.mch does not exist after the run.","commonSituations":"mcs tool missing or wrong version; mcs hit an internal error on malformed .mc files; out of disk space in temp; permissions issue; a stale temp_dir reused incorrectly.","solutions":["Re-run with -log_level debug to capture the mcs command output and return code.","Verify mcs_path resolves to a working mcs built for this JIT/EE interface version.","Free disk space / check write permissions in temp_location; avoid reusing a temp_dir from a failed run without --clean.","If a specific .mc is corrupt, isolate and exclude it, or re-collect."],"exampleFix":"// before\npython superpmi.py collect 'cmd'   # merge produced no base.mch -> 'MCH file failed to be generated at: .../base.mch'\n// after\npython superpmi.py collect 'cmd' -log_level debug   # inspect mcs failure, fix mcs/disk, then re-run","handlingStrategy":"validation","validationCode":"import os\nif not os.path.isfile(base_mch_file):\n    raise SystemExit(f\"mcs -merge did not produce {base_mch_file}; check mcs tool and inputs\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure mcs is built for the same JIT/EE interface version as the collected .mc files.","Run with -log_level debug to capture the mcs command and its output for diagnosis."],"tags":["superpmi","collect","mcs","merge","python"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}