diff --git a/backend/open_webui/utils/agents/codex.py b/backend/open_webui/utils/agents/codex.py index 7d5824d75b..dee7ed4e82 100644 --- a/backend/open_webui/utils/agents/codex.py +++ b/backend/open_webui/utils/agents/codex.py @@ -173,7 +173,7 @@ async def run(transport, output, prompt, images, options): if turn.get('id') != turn_id: continue if turn.get('status') == 'failed' or turn.get('error'): - raise ValueError(str(turn.get('error') or 'Codex turn failed')) + raise ValueError((turn.get('error') or {}).get('message') or 'Codex turn failed') return elif method == 'thread/tokenUsage/updated': usage = (params.get('tokenUsage') or {}).get('last') or {} @@ -187,7 +187,7 @@ async def run(transport, output, prompt, images, options): if native in usage } elif method == 'error' and not params.get('willRetry'): - raise ValueError(str(params.get('error') or params)) + raise ValueError((params.get('error') or {}).get('message') or str(params)) except asyncio.CancelledError: if thread_id and turn_id: with contextlib.suppress(Exception):