From 8ca4514709b08d3f988d23655b4d89dc13af6f4d Mon Sep 17 00:00:00 2001 From: Giulia Stefania Imbrea Date: Tue, 15 Jul 2025 11:45:36 +0300 Subject: [PATCH 1/4] Add detailed error logging for client credentials authentication --- src/uipath/_cli/_auth/_client_credentials.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/uipath/_cli/_auth/_client_credentials.py b/src/uipath/_cli/_auth/_client_credentials.py index b6042d2b..aa0e5479 100644 --- a/src/uipath/_cli/_auth/_client_credentials.py +++ b/src/uipath/_cli/_auth/_client_credentials.py @@ -106,11 +106,19 @@ def authenticate( "refresh_token": "", "id_token": "", } + case 400: + console.error( "Invalid client credentials or request parameters." ) + try: + error_details = response.json() + console.error(f"DEBUG: Error details: {error_details}") + except: + console.error(f"DEBUG: Raw error response: {response.text}") return None + case 401: console.error("Unauthorized: Invalid client credentials.") return None From bb738431fedf27c0314eac7319f315937fbba13d Mon Sep 17 00:00:00 2001 From: Giulia Stefania Imbrea Date: Tue, 15 Jul 2025 12:27:15 +0300 Subject: [PATCH 2/4] Modified order of debugging logs --- src/uipath/_cli/_auth/_client_credentials.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uipath/_cli/_auth/_client_credentials.py b/src/uipath/_cli/_auth/_client_credentials.py index aa0e5479..c019ad6d 100644 --- a/src/uipath/_cli/_auth/_client_credentials.py +++ b/src/uipath/_cli/_auth/_client_credentials.py @@ -108,15 +108,16 @@ def authenticate( } case 400: + try: + error_details = response.json() + console.info(f"DEBUG: Error details: {error_details}") + except: + console.info(f"DEBUG: Raw error response: {response.text}") console.error( "Invalid client credentials or request parameters." ) - try: - error_details = response.json() - console.error(f"DEBUG: Error details: {error_details}") - except: - console.error(f"DEBUG: Raw error response: {response.text}") + return None case 401: From 76c2f6c5e6baf22a9482a61c2f56100d5320ad0b Mon Sep 17 00:00:00 2001 From: Giulia Stefania Imbrea Date: Tue, 15 Jul 2025 12:30:42 +0300 Subject: [PATCH 3/4] added Exception --- src/uipath/_cli/_auth/_client_credentials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uipath/_cli/_auth/_client_credentials.py b/src/uipath/_cli/_auth/_client_credentials.py index c019ad6d..3e3f0385 100644 --- a/src/uipath/_cli/_auth/_client_credentials.py +++ b/src/uipath/_cli/_auth/_client_credentials.py @@ -111,7 +111,7 @@ def authenticate( try: error_details = response.json() console.info(f"DEBUG: Error details: {error_details}") - except: + except Exception: console.info(f"DEBUG: Raw error response: {response.text}") console.error( From c8b0edf3266f585603fe17b0c713c7f6b7bfbca2 Mon Sep 17 00:00:00 2001 From: giulia Date: Wed, 16 Jul 2025 14:55:22 +0300 Subject: [PATCH 4/4] run_cli messages --- src/uipath/_cli/cli_run.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/uipath/_cli/cli_run.py b/src/uipath/_cli/cli_run.py index 62a6bb1b..93f09702 100644 --- a/src/uipath/_cli/cli_run.py +++ b/src/uipath/_cli/cli_run.py @@ -62,9 +62,13 @@ def python_run_middleware( try: async def execute(): - context = UiPathRuntimeContext.from_config( - env.get("UIPATH_CONFIG_PATH", "uipath.json") - ) + config_path = env.get("UIPATH_CONFIG_PATH", "uipath.json") + console.info(f"[DEBUG] Using config path: {config_path}") + console.info(f"[DEBUG] Entrypoint argument: {entrypoint}") + console.info(f"[DEBUG] Entrypoint absolute path: {os.path.abspath(entrypoint) if entrypoint else None}") + console.info(f"[DEBUG] Entrypoint exists: {os.path.exists(entrypoint) if entrypoint else None}") + console.info(f"[DEBUG] Input: {input}") + context = UiPathRuntimeContext.from_config(config_path) context.entrypoint = entrypoint context.input = input context.resume = resume @@ -93,6 +97,7 @@ async def execute(): return MiddlewareResult(should_continue=False) except UiPathRuntimeError as e: + console.info(f"[DEBUG][UiPathRuntimeError] {type(e).__name__}: {e}") return MiddlewareResult( should_continue=False, error_message=f"Error: {e.error_info.title} - {e.error_info.detail}", @@ -100,6 +105,7 @@ async def execute(): ) except Exception as e: # Handle unexpected errors + console.info(f"[DEBUG][Exception] {type(e).__name__}: {e}") return MiddlewareResult( should_continue=False, error_message=f"Error: Unexpected error occurred - {str(e)}",