From c50e3b4ac0842ccd1c646106215fd394f776abf6 Mon Sep 17 00:00:00 2001 From: Javid Jamae Date: Sun, 19 Apr 2026 12:00:15 -0500 Subject: [PATCH] fix: UnboundLocalError in transcribe when cloud + include_text=false When response_type is "cloud" and include_text is false, the else branch assigned `text_file = None` but the function returns `text_filename` on line 153, raising `UnboundLocalError: cannot access local variable 'text_filename' where it is not associated with a value`. Reproducible via any call asking the toolkit for SRT-only cloud output: POST /v1/media/transcribe { "media_url": "https://.../audio.mp3", "response_type": "cloud", "include_text": false, "include_srt": true } Fix: assign the correct variable name in the else branch. Co-Authored-By: Claude Opus 4.7 (1M context) --- services/v1/media/media_transcribe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/v1/media/media_transcribe.py b/services/v1/media/media_transcribe.py index 4514a9f2..a62ff8ff 100644 --- a/services/v1/media/media_transcribe.py +++ b/services/v1/media/media_transcribe.py @@ -134,7 +134,7 @@ def process_transcribe_media(media_url, task, include_text, include_srt, include with open(text_filename, 'w') as f: f.write(text) else: - text_file = None + text_filename = None if include_srt is True: srt_filename = os.path.join(LOCAL_STORAGE_PATH, f"{job_id}.srt")