{"record":{"id":"31fb585882335b86","repo":"BerriAI/litellm","slug":"error-31fb58","errorCode":null,"errorMessage":"{error}","messagePattern":"\\{error\\}","errorType":"exception","errorClass":"BytezError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bytez/chat/transformation.py","lineNumber":197,"sourceCode":"        self,\n        model: str,\n        raw_response: httpx.Response,\n        model_response: ModelResponse,\n        logging_obj: LiteLLMLoggingObj,\n        request_data: dict,\n        messages: list[AllMessageValues],\n        optional_params: dict,\n        litellm_params: dict,\n        encoding: Any,\n        api_key: str | None = None,\n        json_mode: bool | None = None,\n    ) -> ModelResponse:\n        json: Final = raw_response.json()\n\n        error: Final = json.get(\"error\")\n\n        if error is not None:\n            raise BytezError(\n                message=str(json[\"error\"]),\n                status_code=raw_response.status_code,\n            )\n\n        # set meta data here\n        model_response.created = int(time.time())\n        model_response.model = model\n\n        # Add the output\n        output: Final = json.get(\"output\")\n\n        message: Final = model_response.choices[0].message\n\n        message.content = output[\"content\"][0][\"text\"]\n\n        messages = adapt_messages_to_bytez_standard(messages=messages)\n\n        # NOTE We are approximating tokens, to get the true values we will need to update our BE","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bytez/chat/transformation.py#L179-L215","documentation":"After a successful HTTP response, the Bytez transform checks the JSON body for a top-level 'error' key; if present it raises BytezError with that error stringified and the HTTP status code. Bytez reports application-level failures (model errors, inference crashes, account issues) inside an otherwise 200-ish response, so this is the primary Bytez failure surface.","triggerScenarios":"Non-streaming litellm.completion against a bytez/ model where the response JSON contains {\"error\": ...} — e.g. model failed to load, out-of-credits, invalid model path, or inference exception on Bytez's side.","commonSituations":"Incorrect model repository ids; Bytez account quota exhaustion; transient model cold-start or GPU failures; content the hosted model rejects internally.","solutions":["Read the message — it embeds Bytez's own error text, which names the real cause (model not found, billing, inference error).","For model issues, verify the model id matches a Bytez-supported repository path and correct it.","For quota/billing, top up or switch accounts/keys.","For transient inference failures, retry with backoff."],"exampleFix":"# before\nlitellm.completion(model=\"bytez/some-wrong/model-id\", messages=m)\n\n# after\nlitellm.completion(model=\"bytez/meta-llama/Llama-3-8b\", messages=m)  # valid Bytez model path","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.llms.bytez.chat.transformation import BytezError\n\ntry:\n    resp = litellm.completion(model=\"bytez/...\", messages=m)\nexcept BytezError as e:\n    msg = str(e)\n    if \"model\" in msg.lower() and \"not\" in msg.lower():\n        fix_model_id_and_retry()\n    elif e.status_code in (402, 429):\n        handle_billing_or_rate_limit()\n    else:\n        retry_with_backoff()  # transient inference failures","preventionTips":["Validate Bytez model ids against your account's available models before first use.","Monitor credit balance and set low-balance alerts to avoid mid-run failures.","Classify BytezError by message content to route to model fix, billing, or retry."],"tags":["bytez","chat","api-error","response-body"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}