From 3d6a092c7624e9b1bcb1572dc5dbac7ec910abdc Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:41:11 +0100 Subject: [PATCH] fix: a failed Codex turn shows a raw object as the error instead of Codex's message (#35385) When Codex failed a turn, the reply's error showed Codex's whole error object, field names and all, instead of the reason. The error now shows Codex's own message, the same way Claude Code and Pi failures show theirs. Fixes #35381 --- backend/open_webui/utils/agents/codex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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):