{"record":{"id":"c2eb3651a63aa3bb","repo":"dotnet/runtime","slug":"expected-a-ilc-rsp-file-for-nativeaot-but-got","errorCode":null,"errorMessage":"Expected a '.ilc.rsp' file for nativeaot, but got {original_rsp_filepath}","messagePattern":"Expected a '\\.ilc\\.rsp' file for nativeaot, but got (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/superpmi.py","lineNumber":1189,"sourceCode":"                # Note: crossgen2 compiles in parallel by default. However, it seems to lead to sharing violations\n                # in SuperPMI collection, accessing the MC file. So, disable crossgen2 parallism by using\n                # the \"--parallelism:1\" switch, and allowing coarse-grained (per-assembly) parallelism here.\n                # It turns out this works better anyway, as there is a lot of non-parallel time between\n                # crossgen2 parallel compilations.\n                helper = AsyncSubprocessHelper(assemblies, verbose=True)\n                helper.run_to_completion(run_crossgen2, self)\n\n                os.environ.clear()\n                os.environ.update(old_env)\n            ################################################################################################ end of \"self.coreclr_args.crossgen2 is True\"\n\n            ################################################################################################ Do collection using nativeaot\n            if self.coreclr_args.nativeaot is True:\n                logging.debug(\"Starting collection using nativeaot\")\n\n                async def run_nativeaot(print_prefix, original_rsp_filepath, self):\n                    if not original_rsp_filepath.endswith(\".ilc.rsp\"):\n                        raise RuntimeError(f\"Expected a '.ilc.rsp' file for nativeaot, but got {original_rsp_filepath}\")\n\n                    # The contents of the rsp contain many knobs and arguments that represent customer scenarios.\n                    # Make a copy of the .ilc.rsp file as we are going to modify it. We do not want to modify the original one.\n                    # The modifications include re-writing paths for references, input assembly and the output.\n                    # We do this because the current paths in the rsp *may* not exist by the time we want to run ilc.\n                    rsp_filepath = os.path.join(self.temp_location, make_safe_filename(\"nativeaot_\" + original_rsp_filepath) + \".rsp\")\n                    shutil.copyfile(original_rsp_filepath, rsp_filepath)\n\n                    rsp_file = open(rsp_filepath, \"r\")\n                    rsp_contents = rsp_file.readlines()\n                    rsp_file.close()\n\n                    original_input_filepath = \"\"\n\n                    for line in rsp_contents:\n                        if not line.startswith(\"-\"):\n                            original_input_filepath = line\n","sourceCodeStart":1171,"sourceCodeEnd":1207,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/superpmi.py#L1171-L1207","documentation":"Raised inside run_nativeaot() in superpmi.py when an rsp file passed to the nativeaot collector does not end with '.ilc.rsp'. NativeAOT collection parses ilc response files; a differently-named file is a programming/usage error.","triggerScenarios":"Passing a non-.ilc.rsp file via -ilc_rsps (or a directory whose filtered contents include a stray non-rsp file), so original_rsp_filepath does not end with '.ilc.rsp'.","commonSituations":"Pointing -ilc_rsps at a .rsp without the 'ilc.' prefix; a stale/mis-generated rsp; directory globs picking up unrelated files.","solutions":["Ensure every file passed via -ilc_rsps ends with '.ilc.rsp' (e.g. ComWrappers.ilc.rsp).","Regenerate the ilc.rsp via the normal nativeaot build if the rsp is missing or mis-named.","Use -exclude to filter out stray non-rsp files when pointing -ilc_rsps at a directory."],"exampleFix":"// before\npython superpmi.py collect --nativeaot -ilc_rsps ComWrappers.rsp   # 'Expected a .ilc.rsp file ... but got ComWrappers.rsp'\n// after\npython superpmi.py collect --nativeaot -ilc_rsps ComWrappers/native/ComWrappers.ilc.rsp","handlingStrategy":"validation","validationCode":"bad = [p for p in ilc_rsps if not p.endswith(\".ilc.rsp\")]\nif bad:\n    raise SystemExit(\"All -ilc_rsps files must end with '.ilc.rsp'; offending: \" + \", \".join(bad))","typeGuard":"def is_ilc_rsp(path: str) -> bool:\n    return path.endswith(\".ilc.rsp\")","tryCatchPattern":null,"preventionTips":["Generate ilc.rsp files from the nativeaot build rather than constructing paths by hand.","Filter directory inputs to '*.ilc.rsp' before passing them to collect."],"tags":["superpmi","collect","nativeaot","argument-validation","python"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}