{"record":{"id":"048140f6154576ac","repo":"unslothai/unsloth","slug":"the-local-transcription-runtime-returned-http-res","errorCode":null,"errorMessage":"The local transcription runtime returned HTTP {response.status}.","messagePattern":"The local transcription runtime returned HTTP (.+?)\\.","errorType":"exception","errorClass":"SttEngineUnavailableError","httpStatus":501,"severity":"error","filePath":"studio/backend/core/inference/stt_ggml_sidecar.py","lineNumber":1191,"sourceCode":"            \"127.0.0.1\", self._port, timeout = _TRANSCRIBE_TIMEOUT_SECONDS\n        )\n        cancel_done = threading.Event()\n        if cancel_event is not None:\n            threading.Thread(\n                target = _close_connection_on_cancel,\n                args = (connection, cancel_event, cancel_done),\n                daemon = True,\n            ).start()\n        try:\n            connection.request(\n                \"POST\",\n                \"/inference\",\n                body = body,\n                headers = {\"Content-Type\": f\"multipart/form-data; boundary={boundary}\"},\n            )\n            with connection.getresponse() as response:\n                if not 200 <= response.status < 300:\n                    raise SttEngineUnavailableError(\n                        f\"The local transcription runtime returned HTTP {response.status}.\"\n                    )\n                payload = json.loads(response.read().decode(\"utf-8\"))\n        except (SttAudioDecodeError, SttEngineUnavailableError):\n            raise\n        except Exception as exc:\n            # A cancel closes this socket deliberately, so it is not evidence of a broken\n            # runtime and must not disable the engine.\n            if cancel_event is None or not cancel_event.is_set():\n                note_runtime_inference_failure(f\"{type(exc).__name__}: {exc}\")\n            raise SttEngineUnavailableError(\n                \"The local transcription runtime did not answer the request. \"\n                \"Transcription will use the Transformers engine from now on.\"\n            ) from exc\n        finally:\n            cancel_done.set()\n            connection.close()\n        text = payload.get(\"text\")","sourceCodeStart":1173,"sourceCodeEnd":1209,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/stt_ggml_sidecar.py#L1173-L1209","documentation":"SttEngineUnavailableError raised in the /inference POST handler: whisper-server answered but with a non-2xx status. The response body is not inspected; the status alone fails the request. 409 typically means the model is not (or no longer) loaded server-side; 5xx means the server choked on the payload.","triggerScenarios":"Calling _post_inference with WAV bytes when the sidecar's model was unloaded/switched server-side (409), the WAV is malformed for whisper.cpp, or the server hit an internal error during transcription (5xx).","commonSituations":"Idle unload or model switch raced the inference POST; oversized/invalid audio payload; whisper-server version mismatch with the expected API; server in a degraded state after an earlier failure.","solutions":["Retry once — a 409 after an idle unload usually resolves because transcribe() re-loads under the lock on the next call.","Check that audio was encoded as 16 kHz mono WAV (_pcm_to_wav_bytes output) and within size caps.","Run `unsloth studio update` to realign the managed whisper-server build.","If 5xx persists, restart Studio so the sidecar respawns the child cleanly."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = sidecar.transcribe(audio, language=lang)\nexcept SttEngineUnavailableError as exc:\n    if \"returned HTTP 409\" in str(exc) or \"returned HTTP 5\" in str(exc):\n        result = sidecar.transcribe(audio, language=lang)  # reload under lock fixes 409\n    else:\n        raise","preventionTips":["Always call transcribe through the sidecar (it re-loads under _lock) rather than posting to the port directly.","Validate audio is 16 kHz mono WAV within size caps before submission.","Keep the managed whisper-server version aligned with the sidecar's client."],"tags":["stt","ggml","http","whisper-cpp","inference"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}