{"record":{"id":"531c00ed64990d67","repo":"dotnet/runtime","slug":"invalid-summary-type-coreclr-args-summary-type","errorCode":null,"errorMessage":"Invalid summary_type: {coreclr_args.summary_type}","messagePattern":"Invalid summary_type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/superpmi.py","lineNumber":4697,"sourceCode":"\ndef summarize_json_summaries(coreclr_args):\n    logging.info(\"Summarizing {} files:\".format(coreclr_args.summary_type))\n    for file in coreclr_args.summaries:\n        logging.info(\"  {}\".format(file))\n\n    summary_type_to_prefix = {\n        \"asmdiffs\": \"diff\",\n        \"metricdiff\": \"metricdiff\",\n        \"tpdiff\": \"tpdiff\",\n    }\n\n    if coreclr_args.summary_type not in summary_type_to_prefix:\n        logging.error(\n            \"Invalid summary_type '%s'. Valid values are: %s\",\n            coreclr_args.summary_type,\n            \", \".join(sorted(summary_type_to_prefix.keys())),\n        )\n        raise ValueError(f\"Invalid summary_type: {coreclr_args.summary_type}\")\n\n    file_name_prefix = summary_type_to_prefix[coreclr_args.summary_type]\n    if coreclr_args.output_long_summary_path:\n        overall_md_summary_file = coreclr_args.output_long_summary_path\n    else:\n        overall_md_summary_file = create_unique_file_name(coreclr_args.spmi_location, file_name_prefix + \"_summary\", \"md\")\n        if os.path.isfile(overall_md_summary_file):\n            os.remove(overall_md_summary_file)\n\n    short_md_summary_file = create_unique_file_name(coreclr_args.spmi_location, file_name_prefix + \"_short_summary\", \"md\")\n    if os.path.isfile(short_md_summary_file):\n        os.remove(short_md_summary_file)\n\n    if coreclr_args.summary_type == \"asmdiffs\":\n        base_jit_options = []\n        diff_jit_options = []\n        summarizable_asm_diffs = []\n","sourceCodeStart":4679,"sourceCodeEnd":4715,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/scripts/superpmi.py#L4679-L4715","documentation":"Raised in `summarize_json_summaries` (superpmi.py:4691-4697) as a ValueError when coreclr_args.summary_type is not one of the supported keys: asmdiffs, metricdiff, or tpdiff. The function first logs an error listing valid values, then raises. argparse marks -summary_type required but does not restrict choices, so an invalid string reaches this check.","triggerScenarios":"Running `superpmi.py summarize -summary_type <bad>` where <bad> is not asmdiffs/metricdiff/tpdiff (e.g. 'asm', 'throughput', 'tp', a typo). The dictionary lookup fails and the ValueError is raised after logging the valid set.","commonSituations":"Using shorthand or pre-renamed names (e.g. 'throughput' instead of 'tpdiff'); typos; outdated docs/scripts referencing a renamed summary type.","solutions":["Use one of the valid values: asmdiffs, tpdiff, or metricdiff (check the logged 'Valid values are:' line).","If automating, restrict the summary_type input to the allowed set before invoking the script.","Update any wrapper scripts still passing a renamed/legacy summary type name."],"exampleFix":"// before\nsuperpmi.py summarize -summary_type throughput -summaries out.json\n// after\nsuperpmi.py summarize -summary_type tpdiff -summaries out.json","handlingStrategy":"type-guard","validationCode":"valid = {'asmdiffs', 'metricdiff', 'tpdiff'}\nif args.summary_type not in valid:\n    raise SystemExit(f'Invalid summary_type {args.summary_type!r}; choose from {sorted(valid)}')","typeGuard":"def is_valid_summary_type(value: str) -> bool:\n    return value in {'asmdiffs', 'metricdiff', 'tpdiff'}\n\n# narrowing before calling summarize\nsummary_type = coreclr_args.summary_type\nassert is_valid_summary_type(summary_type), 'unsupported summary_type'","tryCatchPattern":null,"preventionTips":["Restrict summary_type to asmdiffs/metricdiff/tpdiff in wrapper scripts.","Watch for renamed/legacy summary type names in old docs."],"tags":["config","args","summary","superpmi"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}