From bd83be20e59d7f3169395f611166da5b23ce4b1a Mon Sep 17 00:00:00 2001 From: andersonid Date: Mon, 6 Oct 2025 11:00:06 -0300 Subject: [PATCH] fix: handle Celery task error info properly in status API --- app/api/routes.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/api/routes.py b/app/api/routes.py index f7952ac..90b288c 100644 --- a/app/api/routes.py +++ b/app/api/routes.py @@ -2060,10 +2060,16 @@ async def get_task_status(task_id: str): 'status': 'Task completed successfully' } else: # FAILURE + error_info = result.info + if isinstance(error_info, dict): + error_message = error_info.get('error', str(error_info)) + else: + error_message = str(error_info) + response = { 'task_id': task_id, 'state': result.state, - 'error': str(result.info), + 'error': error_message, 'status': 'Task failed' }