{"record":{"id":"83ab83e308baba4e","repo":"BerriAI/litellm","slug":"response-text","errorCode":null,"errorMessage":"{response.text}","messagePattern":"\\{response\\.text\\}","errorType":"exception","errorClass":"BytezError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bytez/chat/transformation.py","lineNumber":274,"sourceCode":"        messages: list,\n        client: HTTPHandler | AsyncHTTPHandler | None = None,\n        json_mode: bool | None = None,\n        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,","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bytez/chat/transformation.py#L256-L292","documentation":"In the synchronous streaming path, the httpx POST to Bytez is wrapped in a try/except for httpx.HTTPStatusError; if httpx raises one, it is converted to BytezError with the upstream status code and response text. This surfaces transport-level HTTP failures (4xx/5xx) that raise during the request call.","triggerScenarios":"stream=True litellm.completion to a bytez/ model where the initial POST raises httpx.HTTPStatusError — auth failures, 404 endpoints (bad api_base/model path), 5xx from Bytez — during connection/request handling.","commonSituations":"Custom/wrong api_base; expired API key producing 401 at connect time; Bytez outages returning 502/503 at request start.","solutions":["Read the embedded response text for the upstream reason.","Verify api_base (if overridden) points at Bytez's chat completions endpoint.","Check/refresh BYTEZ_API_KEY for 401s.","Retry with backoff for 5xx; check Bytez status pages if persistent."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    stream = litellm.completion(model=\"bytez/...\", messages=m, stream=True)\nexcept BytezError as e:\n    if e.status_code >= 500 or e.status_code == 429:\n        time.sleep(2 ** attempt); retry()\n    elif e.status_code == 401:\n        rotate_key_and_alert()\n    else:\n        raise","preventionTips":["Verify api_base overrides against Bytez's documented endpoint before shipping.","Wrap stream initialization separately from stream consumption so transport errors are distinguishable.","Add jittered retries for 429/5xx at stream start."],"tags":["bytez","streaming","http-status","sync"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}