{"record":{"id":"b5957df24715acf7","repo":"dotnet/runtime","slug":"pass-only-one-tiering-option","errorCode":null,"errorMessage":"Pass only one tiering option.","messagePattern":"Pass only one tiering option\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/superpmi.py","lineNumber":726,"sourceCode":"            self.corerun = os.path.join(self.core_root, self.corerun_tool_name)\n\n        if coreclr_args.crossgen2:\n            self.corerun = os.path.join(self.core_root, self.corerun_tool_name)\n\n        if coreclr_args.pmi or coreclr_args.crossgen2:\n            self.assemblies = coreclr_args.assemblies\n            self.exclude = coreclr_args.exclude\n            if coreclr_args.tiered_compilation or coreclr_args.tiered_pgo:\n               raise RuntimeError(\"Tiering options have no effect for pmi or crossgen2 collections.\")\n\n        if coreclr_args.nativeaot:\n            self.ilc_rsps = coreclr_args.ilc_rsps\n            self.exclude = coreclr_args.exclude\n            if coreclr_args.tiered_compilation or coreclr_args.tiered_pgo:\n                raise RuntimeError(\"Tiering options have no effect for nativeaot collections.\")\n\n        if coreclr_args.tiered_compilation and coreclr_args.tiered_pgo:\n            raise RuntimeError(\"Pass only one tiering option.\")\n\n        self.coreclr_args = coreclr_args\n\n        self.temp_location = None\n\n        # Pathname for a temporary .MCL file used for noticing SuperPMI replay failures against base MCH.\n        self.base_fail_mcl_file = None\n\n        # The base .MCH file path\n        self.base_mch_file = None\n\n        # Final .MCH file path\n        if self.coreclr_args.output_mch_path is not None:\n            self.final_mch_file = os.path.abspath(self.coreclr_args.output_mch_path)\n            final_mch_dir = os.path.dirname(self.final_mch_file)\n            if not os.path.isdir(final_mch_dir):\n                os.makedirs(final_mch_dir)\n        else:","sourceCodeStart":708,"sourceCodeEnd":744,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/scripts/superpmi.py#L708-L744","documentation":"Raised in SuperPMICollection.__init__ (superpmi.py:725-726) when both --tiered_compilation and --tiered_pgo are passed to the `collect` subcommand. The flags are treated as mutually exclusive because --tiered_pgo already sets DOTNET_TieredCompilation=1 in addition to DOTNET_TieredPGO=1, so specifying both is redundant and ambiguous. This is a runtime guard, not an argparse mutually_exclusive_group, so argparse will not catch it earlier.","triggerScenarios":"Running `superpmi.py collect ... --tiered_compilation --tiered_pgo ...`. Both are `store_true` flags with no argparse choices restriction, so the command parses successfully and the check in __init__ is what rejects it.","commonSituations":"Starting from a tiered-compilation collection command and appending --tiered_pgo to enable PGO without dropping the first flag; matrix/CI scripts that toggle the two flags from independent variables and accidentally set both to true.","solutions":["Remove --tiered_compilation and keep only --tiered_pgo (it enables both DOTNET_TieredCompilation=1 and DOTNET_TieredPGO=1).","If you only want tiered compilation without PGO, drop --tiered_pgo and keep --tiered_compilation alone.","Fix the script/matrix that assembles the CLI args to treat the two flags as mutually exclusive."],"exampleFix":"// before\nsuperpmi.py collect --crossgen2 -assemblies Foo --tiered_compilation --tiered_pgo\n// after\nsuperpmi.py collect --crossgen2 -assemblies Foo --tiered_pgo","handlingStrategy":"validation","validationCode":"# Before invoking superpmi collect, reject the conflicting combination\nimport sys\ntiered_compilation = '--tiered_compilation' in sys.argv\ntiered_pgo = '--tiered_pgo' in sys.argv\nif tiered_compilation and tiered_pgo:\n    raise SystemExit('Use only one of --tiered_compilation / --tiered_pgo (tiered_pgo implies tiered_compilation).')\n# ...then launch superpmi.py","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --tiered_compilation and --tiered_pgo as mutually exclusive in any wrapper/matrix that builds the command line.","Remember --tiered_pgo already sets DOTNET_TieredCompilation=1."],"tags":["config","args","superpmi","tiering"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}