From 9315e04f17d64c46264116cfd75111e9f0ffe24b Mon Sep 17 00:00:00 2001 From: rtmalikian Date: Thu, 18 Jun 2026 17:44:17 -0700 Subject: [PATCH] fix: replace raise UserWarning with warnings.warn in verify_report_format In monai/auto3dseg/utils.py line 287, was used which raises the warning as an exception, crashing the program. The intent was to emit a warning since the function returns bool to indicate format validity. Replaced with which correctly emits a UserWarning without crashing. Fixes #8927 Signed-off-by: Raphael Malikian --- monai/auto3dseg/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/auto3dseg/utils.py b/monai/auto3dseg/utils.py index d6fb561242..f349561bdc 100644 --- a/monai/auto3dseg/utils.py +++ b/monai/auto3dseg/utils.py @@ -284,7 +284,7 @@ def verify_report_format(report: dict, report_format: dict) -> bool: if isinstance(v_fmt, list) and isinstance(v, list): if len(v_fmt) != 1: - raise UserWarning("list length in report_format is not 1") + warnings.warn("list length in report_format is not 1", stacklevel=2) if len(v_fmt) > 0 and len(v) > 0: return verify_report_format(v[0], v_fmt[0]) else: