From 4cca7f569d6bddadf79ad81c7fca71e9915f4f43 Mon Sep 17 00:00:00 2001 From: annguyenNous Date: Wed, 3 Jun 2026 18:00:43 +0700 Subject: [PATCH] fix(tools): add raise_for_status for MiniMax t2a_v2 TTS path The MiniMax t2a_v2 code path calls response.json() without first checking the HTTP status code. If the API returns HTTP 4xx/5xx with non-JSON content (e.g. HTML error page), response.json() raises an opaque JSONDecodeError instead of a clear HTTPError. The non-t2a_v2 path already has response.raise_for_status() at line 1299. Add the same check before response.json() in the t2a_v2 path for consistent error handling. --- tools/tts_tool.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/tts_tool.py b/tools/tts_tool.py index cab2cc584..e1d20df3f 100644 --- a/tools/tts_tool.py +++ b/tools/tts_tool.py @@ -1261,6 +1261,7 @@ def _generate_minimax_tts(text: str, output_path: str, tts_config: Dict[str, Any if is_t2a_v2: # t2a_v2 returns JSON with hex-encoded audio + response.raise_for_status() result = response.json() base_resp = result.get("base_resp", {}) status_code = base_resp.get("status_code", -1)