{"record":{"id":"0131512a4305e8b4","repo":"BerriAI/litellm","slug":"response-text-013151","errorCode":null,"errorMessage":"response.text","messagePattern":"response\\.text","errorType":"exception","errorClass":"BytezError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bytez/chat/transformation.py","lineNumber":277,"sourceCode":"        signed_json_body: bytes | None = None,\n    ) -> \"BytezCustomStreamWrapper\":\n        if client is None or isinstance(client, AsyncHTTPHandler):\n            client = _get_httpx_client(params={})\n\n        try:\n            response: Final = client.post(\n                api_base,\n                headers=headers,\n                data=json.dumps(data),\n                stream=True,\n                logging_obj=logging_obj,\n                timeout=STREAMING_TIMEOUT,\n            )\n        except httpx.HTTPStatusError as e:\n            raise BytezError(status_code=e.response.status_code, message=e.response.text)\n\n        if response.status_code != 200:\n            raise BytezError(status_code=response.status_code, message=response.text)\n\n        completion_stream: Final = response.iter_text()\n\n        streaming_response: Final = BytezCustomStreamWrapper(\n            completion_stream=completion_stream,\n            model=model,\n            custom_llm_provider=custom_llm_provider,\n            logging_obj=logging_obj,\n        )\n        return streaming_response\n\n    @track_llm_api_timing()\n    async def get_async_custom_stream_wrapper(\n        self,\n        model: str,\n        custom_llm_provider: str,\n        logging_obj: LiteLLMLoggingObj,\n        api_base: str,","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bytez/chat/transformation.py#L259-L295","documentation":"The synchronous streaming path checks the POST response explicitly: any status other than 200 raises BytezError with that status code and response.text as the message. This is the normal route by which non-200s on stream=True bytez calls surface, since httpx does not raise HTTPStatusError by itself.","triggerScenarios":"stream=True bytez completion returning 401 (invalid key), 404 (bad model/api_base), 429 (rate limit), 500/502/503 (server or gateway); the response body (error page or JSON) becomes the message verbatim.","commonSituations":"Batch/agent workloads tripping 429s; misconfigured api_base; Bytez outages; error bodies that are HTML, making exception messages long and noisy in logs.","solutions":["Catch BytezError and switch on status_code: refresh key on 401, back off on 429/5xx, fix URL/model on 404.","Retry with exponential backoff and jitter for 429/5xx.","Verify api_base and model path when 404 persists.","Truncate e.message before writing it to logs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.llms.bytez.common_utils import BytezError\n\ntry:\n    stream = litellm.completion(model=\"bytez/org/model\", messages=msgs, stream=True)\n    for chunk in stream:\n        ...\nexcept BytezError as e:\n    if e.status_code == 429:\n        backoff_and_retry()\n    elif e.status_code == 401:\n        refresh_bytez_key()\n    else:\n        raise","preventionTips":["Rate-limit your own callers before Bytez does (429 is the common failure).","Keep api_base and model path in one validated config to avoid 404s."],"tags":["bytez","streaming","http-error","sync","non-200-status"],"backgroundTag":"http-error-response","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}