{"record":{"id":"b070804f3766a335","repo":"BerriAI/litellm","slug":"shape-must-be-of-length-2","errorCode":null,"errorMessage":"Shape must be of length 2.","messagePattern":"Shape must be of length 2\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/triton/embedding/transformation.py","lineNumber":139,"sourceCode":"                continue\n            try:\n                prompt_tokens += token_counter(model=model, text=text)\n            except Exception:\n                prompt_tokens += len(text.split())\n\n        return Usage(\n            prompt_tokens=prompt_tokens,\n            completion_tokens=0,\n            total_tokens=prompt_tokens,\n        )\n\n    def get_error_class(self, error_message: str, status_code: int, headers: dict | httpx.Headers) -> BaseLLMException:\n        return TritonError(message=error_message, status_code=status_code, headers=headers)\n\n    @staticmethod\n    def split_embedding_by_shape(data: list[float], shape: list[int]) -> list[list[float]]:\n        if len(shape) != 2:\n            raise ValueError(\"Shape must be of length 2.\")\n        embedding_size: Final = shape[1]\n        return [data[i * embedding_size : (i + 1) * embedding_size] for i in range(shape[0])]\n","sourceCodeStart":121,"sourceCodeEnd":142,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/triton/embedding/transformation.py#L121-L142","documentation":"Triton embedding splitter guard: split_embedding_by_dims received an embedding shape whose length is not 2 (expected [batch, dim]), so the response tensor cannot be split per dimension batch as the codepath assumes.","triggerScenarios":"Triggered when the Triton embedding request shape does not have exactly length 2.","commonSituations":"See trigger scenarios.","solutions":["Pass a shape list/tuple of exactly length 2 for the embedding request."],"exampleFix":"shape=[batch_size, seq_len]","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}