dotnet/runtime · error · RuntimeError
MCH file failed to be generated at
Error message
MCH file failed to be generated at: %s
What it means
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.
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.
Example fix
// before python superpmi.py collect 'cmd' # merge produced no base.mch -> 'MCH file failed to be generated at: .../base.mch' // after python superpmi.py collect 'cmd' -log_level debug # inspect mcs failure, fix mcs/disk, then re-run
Defensive patterns
Strategy: validation
Validate before calling
import os
if not os.path.isfile(base_mch_file):
raise SystemExit(f"mcs -merge did not produce {base_mch_file}; check mcs tool and inputs") Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Expected a '.ilc.rsp' file for nativeaot, but got
- Final mch file failed to be generated.
- No .mc files generated.
- Pass only one tiering option.
- Tiering options have no effect for nativeaot collections.
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/0e7387e52bca558d.
Report an issue: GitHub.
Appendix: source
Thrown at src/coreclr/scripts/superpmi.py:1368
raise RuntimeError("No .mc files generated.")
def __merge_mc_files__(self):
""" Merge the mc files that were generated
Notes:
mcs -merge <s_baseMchFile> <s_tempDir>\\*.mc -recursive -dedup -thin
"""
logging.info("Merging MC files")
pattern = os.path.join(self.temp_location, "*.mc")
command = [self.mcs_path, "-merge", self.base_mch_file, pattern, "-recursive", "-dedup", "-thin"]
run_and_log(command)
if not os.path.isfile(self.base_mch_file):
raise RuntimeError("MCH file failed to be generated at: %s" % self.base_mch_file)
# All the individual MC files are no longer necessary, now that we have
# merged them into the base.mch. Delete them.
if not self.coreclr_args.skip_cleanup:
mc_files = [os.path.join(self.temp_location, item) for item in os.listdir(self.temp_location) if item.endswith(".mc")]
for item in mc_files:
os.remove(item)
def __merge_mch_files__(self):
""" Merge MCH files in the mch_files list. This is only used with the `--merge_mch_files` argument.
Notes:
mcs -concat <s_baseMchFile> [self.coreclr_args.mch_files]
"""
logging.info("Merging MCH files")
View on GitHub (pinned to 60108ba66e)