dotnet/runtime · error · RuntimeError
Error, toc file not created correctly at: %s
Error message
Error, toc file not created correctly at: %s
What it means
Raised in `__create_toc__` (superpmi.py:1462-1463) after running `mcs -toc <final.mch>`. The TOC file is `final_mch_file + '.mct'`; if it is not present after the command, the TOC generation failed. The TOC is required for indexed/random access into the MCH during replay.
Source
Thrown at src/coreclr/scripts/superpmi.py:1463
if not self.coreclr_args.skip_cleanup:
if os.path.isfile(self.base_mch_file):
os.remove(self.base_mch_file)
self.base_mch_file = None
def __create_toc__(self):
""" Create a TOC file
Notes:
<mcl> -toc <s_finalMchFile>
"""
logging.info("Creating TOC file")
command = [self.mcs_path, "-toc", self.final_mch_file]
run_and_log(command)
if not os.path.isfile(self.toc_file):
raise RuntimeError("Error, toc file not created correctly at: %s" % self.toc_file)
def __verify_final_mch__(self):
""" Verify the resulting MCH file is error-free when running SuperPMI against it with the same JIT used for collection.
Notes:
<SuperPmiPath> -p -f <s_finalFailMclFile> <s_finalMchFile> <jitPath>
"""
logging.info("Verifying MCH file")
mch_files = [ self.final_mch_file ]
spmi_replay = SuperPMIReplay(self.coreclr_args, mch_files, self.jit_path)
passed = spmi_replay.replay()
if not passed:
raise RuntimeError("Error, unclean replay.")
def __process_for_ci__(self):View on GitHub (pinned to 290d5ab72c)
Solutions
- Confirm final_mch_file is a valid non-empty MCH (errors 166/167 did not occur).
- Inspect the logged `mcs -toc` output for the mcs return code/error.
- Ensure the final MCH directory is writable and has disk space, then re-run with `--skip_collection_step --skip_merge_step`.
Defensive patterns
Strategy: try-catch
Validate before calling
# Confirm the final MCH is valid before invoking the toc step
if not os.path.isfile(final_mch_file) or os.path.getsize(final_mch_file) == 0:
raise SystemExit('final MCH missing/empty; cannot create TOC.') Try / catch
try:
collection.__create_toc__()
except RuntimeError as e:
if 'toc file not created' in str(e):
logging.error('mcs -toc failed; verify final MCH integrity and mcs output.')
raise Prevention
- Validate final MCH before toc creation.
- Ensure the MCH directory is writable for the .mct output.
When it happens
Trigger: The `mcs -toc` command ran but did not create the `.mct` file beside the final MCH. Causes: mcs error on a corrupt/empty final MCH, missing final MCH (errors 166/167), or a write/permission failure.
Common situations: final_mch_file is zero-length or corrupt from a bad merge/clean; mcs binary version mismatch; the MCH directory is read-only so the `.mct` cannot be written.
Related errors
- MCH file failed to be generated at: %s
- Final mch file failed to be generated.
- Error, unclean replay.
- No .mc files generated.
- No active session to reconnect
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/7d16f3d867b152a2.
Report an issue: GitHub.