From f0bac545e4075ddbd42a6266ce9c4e42ee70cbf8 Mon Sep 17 00:00:00 2001 From: Shubhamx404 Date: Mon, 15 Dec 2025 02:07:55 +0530 Subject: [PATCH] Fixed Error Message while validating Challenge Config #4490 --- github/challenge_processing_script.py | 32 ++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/github/challenge_processing_script.py b/github/challenge_processing_script.py index 32c9aae10..3777d3ce5 100644 --- a/github/challenge_processing_script.py +++ b/github/challenge_processing_script.py @@ -167,10 +167,36 @@ def configure_requests_for_localhost(): sys.exit(1) except requests.exceptions.HTTPError as err: - if response.status_code in EVALAI_ERROR_CODES: - is_token_valid = validate_token(response.json()) + status = getattr(response, "status_code", None) + try: + payload = response.json() + except ValueError: + payload = None + + # Handle authentication/authorization failures explicitly + if status == 401: + error_message = "\n🚫 AUTHENTICATION FAILED (HTTP 401): Your EvalAI host token may be invalid or expired.\n" + error_message += "šŸ”‘ Check your token at Profile -> Auth Token on Eval.ai and generate a new one with 'Refresh Token' if needed.\n" + error_message += "šŸ› ļø Update the repository secret used by this Action with the new token and re-run the workflow.\n" + if payload and isinstance(payload, dict): + server_msg = payload.get("error") or payload.get("detail") or payload.get("message") + if server_msg: + error_message += f"\nServer response: {server_msg}" + else: + error_message += f"\nServer returned status {status}." + + print(error_message) + os.environ["CHALLENGE_ERRORS"] = error_message + sys.exit(1) + + # For other EvalAI-specific error codes try to extract useful info safely + if status in EVALAI_ERROR_CODES: + is_token_valid = validate_token(payload) if is_token_valid: - error = response.json()["error"] + if isinstance(payload, dict): + error = payload.get("error") or payload.get("detail") or str(payload) + else: + error = str(payload) error_message = "\nFollowing errors occurred while validating the challenge config:\n{}".format( error )