From 99b42c80ac6cc766f1e0fef0cc49bdb22fd4187c Mon Sep 17 00:00:00 2001 From: codejasleen Date: Tue, 24 Mar 2026 15:29:48 +0530 Subject: [PATCH 1/2] Improve error message for estimation_procedure by showing readable names instead of IDs --- openml/_api_calls.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/openml/_api_calls.py b/openml/_api_calls.py index 179c814e7..965574679 100644 --- a/openml/_api_calls.py +++ b/openml/_api_calls.py @@ -1,6 +1,7 @@ # License: BSD 3-Clause from __future__ import annotations - +from openml.tasks.functions import _get_estimation_procedure_list +import re import contextlib import hashlib import logging @@ -507,7 +508,31 @@ def __parse_server_exception( additional_information, ) else: - full_message = f"{message} - {additional_information}" + full_message = f"{message} - {additional_information}" + + # Improve estimation_procedure error message + if additional_information and "acceptable inputs" in additional_information: + try: + import re + from openml.tasks.functions import _get_estimation_procedure_list + + # Extract IDs + ids = list(map(int, re.findall(r"\d+", additional_information))) + + # Get mapping + procedures = _get_estimation_procedure_list() + mapping = {p["id"]: p["name"] for p in procedures} + + # Format + pretty = [f"{i}: {mapping.get(i, 'Unknown')}" for i in ids] + + full_message = ( + f"{message} - problematic input: [estimation_procedure],\n" + "acceptable inputs:\n" + "\n".join(pretty) + ) + + except Exception: + pass if code in [ 102, # flow/exists post From ba6ff0db8624e45b57c4081d225fb7da15580a5b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 10:05:30 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- openml/_api_calls.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openml/_api_calls.py b/openml/_api_calls.py index 965574679..2b7b32f76 100644 --- a/openml/_api_calls.py +++ b/openml/_api_calls.py @@ -1,7 +1,6 @@ # License: BSD 3-Clause from __future__ import annotations -from openml.tasks.functions import _get_estimation_procedure_list -import re + import contextlib import hashlib import logging @@ -508,12 +507,13 @@ def __parse_server_exception( additional_information, ) else: - full_message = f"{message} - {additional_information}" + full_message = f"{message} - {additional_information}" # Improve estimation_procedure error message if additional_information and "acceptable inputs" in additional_information: try: import re + from openml.tasks.functions import _get_estimation_procedure_list # Extract IDs