{"record":{"id":"cca76b2ecbb2e0cd","repo":"BerriAI/litellm","slug":"raw-response-text-cca76b","errorCode":null,"errorMessage":"{raw_response.text}","messagePattern":"\\{raw_response\\.text\\}","errorType":"http","errorClass":"SambaNovaError","httpStatus":null,"severity":"error","filePath":"litellm/llms/sambanova/embedding/transformation.py","lineNumber":117,"sourceCode":"            \"model\": model,\n            **optional_params,\n        }\n\n    def transform_embedding_response(\n        self,\n        model: str,\n        raw_response: httpx.Response,\n        model_response: EmbeddingResponse,\n        logging_obj: LiteLLMLoggingObj,\n        api_key: str | None,\n        request_data: dict,\n        optional_params: dict,\n        litellm_params: dict,\n    ) -> EmbeddingResponse:\n        try:\n            raw_response_json: Final = raw_response.json()\n        except Exception:\n            raise SambaNovaError(\n                message=raw_response.text,\n                status_code=raw_response.status_code,\n                headers=raw_response.headers,\n            )\n\n        model_response.model = raw_response_json.get(\"model\")\n        model_response.data = raw_response_json.get(\"data\")\n        model_response.object = raw_response_json.get(\"object\")\n\n        usage: Final = Usage(\n            prompt_tokens=raw_response_json.get(\"usage\", {}).get(\"prompt_tokens\", 0),\n            total_tokens=raw_response_json.get(\"usage\", {}).get(\"total_tokens\", 0),\n        )\n\n        model_response.usage = usage\n        return model_response\n\n    def get_error_class(self, error_message: str, status_code: int, headers: dict | httpx.Headers) -> BaseLLMException:","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/sambanova/embedding/transformation.py#L99-L135","documentation":"For SambaNova embeddings, LiteLLM parses the HTTP response with .json(); on failure it raises SambaNovaError whose message is the raw response body text and whose status/headers come from the original response. The body text is the primary diagnostic: it usually reveals why the server returned non-JSON.","triggerScenarios":"api_base pointing at a wrong path (HTML 404 page), an auth error returned as plain text, a gateway/WAF error page, or an empty body from a 502/503 outage at the SambaNova endpoint.","commonSituations":"api_base manually set to a URL that already includes /embeddings plus a typo; expired API key producing a text 401; internal SambaNova Enterprise LaunchPad route changed between environments.","solutions":["Read the body text in the error - an HTML title like '404 Not Found' means the URL path is wrong.","Verify api_base: LiteLLM appends /embeddings only when missing, so do not double-append it yourself.","Check the API key (SAMBANOVA_API_KEY) is set and valid for that deployment.","If 5xx, retry later or check the SambaNova status page / your self-hosted gateway health."],"exampleFix":"# before - path already contains /embeddings and a typo\napi_base='https://api.sambanova.ai/v1/embeddingsx'\n# after - clean base, /embeddings appended automatically\napi_base='https://api.sambanova.ai/v1'","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.llms.sambanova.embeddings import SambaNovaError\n\ntry:\n    resp = litellm.embedding(model='sambanova/E5-Embeddings-300M', input=texts, api_base=API_BASE)\nexcept SambaNovaError as e:\n    log.error('sambanova returned status %s body=%s', e.status_code, e.message)\n    raise","preventionTips":["Do not append /embeddings yourself - LiteLLM appends it when missing.","Canary the /embeddings URL with curl after any gateway or route change."],"tags":["sambanova","embedding","response-parsing","json"],"backgroundTag":"invalid-json-response","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}