dotnet/runtime · error · ValueError
Invalid summary_type: {coreclr_args.summary_type}
Error message
Invalid summary_type: {coreclr_args.summary_type} What it means
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.
Source
Thrown at src/coreclr/scripts/superpmi.py:4697
def summarize_json_summaries(coreclr_args):
logging.info("Summarizing {} files:".format(coreclr_args.summary_type))
for file in coreclr_args.summaries:
logging.info(" {}".format(file))
summary_type_to_prefix = {
"asmdiffs": "diff",
"metricdiff": "metricdiff",
"tpdiff": "tpdiff",
}
if coreclr_args.summary_type not in summary_type_to_prefix:
logging.error(
"Invalid summary_type '%s'. Valid values are: %s",
coreclr_args.summary_type,
", ".join(sorted(summary_type_to_prefix.keys())),
)
raise ValueError(f"Invalid summary_type: {coreclr_args.summary_type}")
file_name_prefix = summary_type_to_prefix[coreclr_args.summary_type]
if coreclr_args.output_long_summary_path:
overall_md_summary_file = coreclr_args.output_long_summary_path
else:
overall_md_summary_file = create_unique_file_name(coreclr_args.spmi_location, file_name_prefix + "_summary", "md")
if os.path.isfile(overall_md_summary_file):
os.remove(overall_md_summary_file)
short_md_summary_file = create_unique_file_name(coreclr_args.spmi_location, file_name_prefix + "_short_summary", "md")
if os.path.isfile(short_md_summary_file):
os.remove(short_md_summary_file)
if coreclr_args.summary_type == "asmdiffs":
base_jit_options = []
diff_jit_options = []
summarizable_asm_diffs = []
View on GitHub (pinned to 290d5ab72c)
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.
Example fix
// before superpmi.py summarize -summary_type throughput -summaries out.json // after superpmi.py summarize -summary_type tpdiff -summaries out.json
Defensive patterns
Strategy: type-guard
Validate before calling
valid = {'asmdiffs', 'metricdiff', 'tpdiff'}
if args.summary_type not in valid:
raise SystemExit(f'Invalid summary_type {args.summary_type!r}; choose from {sorted(valid)}') Type guard
def is_valid_summary_type(value: str) -> bool:
return value in {'asmdiffs', 'metricdiff', 'tpdiff'}
# narrowing before calling summarize
summary_type = coreclr_args.summary_type
assert is_valid_summary_type(summary_type), 'unsupported summary_type' Prevention
- Restrict summary_type to asmdiffs/metricdiff/tpdiff in wrapper scripts.
- Watch for renamed/legacy summary type names in old docs.
When it happens
Trigger: 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.
Common situations: Using shorthand or pre-renamed names (e.g. 'throughput' instead of 'tpdiff'); typos; outdated docs/scripts referencing a renamed summary type.
Related errors
- Pass only one tiering option.
- Specified -base_jit_path does not point to a file
- Expected a '.ilc.rsp' file for nativeaot, but got {original_
- Core_Root not set properly
- Unknown host os: {}
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/531c00ed64990d67.
Report an issue: GitHub.