{"record":{"id":"38cd0e726c0aad7a","repo":"BerriAI/litellm","slug":"bedrock-batch-embedding-input-must-be-a-string","errorCode":null,"errorMessage":"Bedrock batch embedding `input` must be a string (or a single-element list of strings). Got type {type(candidate).__name__} for model={model}.","messagePattern":"Bedrock batch embedding `input` must be a string \\(or a single-element list of strings\\)\\. Got type (.+?) for model=(.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/files/transformation.py","lineNumber":578,"sourceCode":"                    \"record. Got a list with \"\n                    f\"{len(raw_input)} items for model={model}; emit one \"\n                    \"JSONL line per input string instead.\"\n                )\n        else:\n            candidate = raw_input\n\n        # Catches pre-tokenized inputs (List[int] from OpenAI spec, or a\n        # single int slipping past the list-unwrap above).\n        # NOTE: bool is a subclass of int but treating True/False as a token\n        # is meaningless either way, so the broad check is fine.\n        if isinstance(candidate, (list, int)):\n            raise NotImplementedError(\n                \"Bedrock Titan v2 batch embedding does not support \"\n                \"pre-tokenized integer inputs. Pass `input` as a string \"\n                f\"(model={model}).\"\n            )\n        if not isinstance(candidate, str):\n            raise ValueError(\n                \"Bedrock batch embedding `input` must be a string (or a \"\n                \"single-element list of strings). Got type \"\n                f\"{type(candidate).__name__} for model={model}.\"\n            )\n        return candidate\n\n    def _map_openai_embedding_to_bedrock_params(\n        self,\n        openai_request_body: _OpenAIBatchRecordBody,\n        model: str,\n    ) -> dict[str, object]:\n        \"\"\"\n        Transform an OpenAI /v1/embeddings request body into the\n        Bedrock InvokeModel `modelInput` for embedding models that AWS\n        supports via batch inference (CreateModelInvocationJob).\n\n        Currently routes Amazon Titan Text Embeddings V2 only; other\n        embedding providers (Titan G1, Titan Multimodal, Cohere Embed,","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/files/transformation.py#L560-L596","documentation":"Error \"Bedrock batch embedding `input` must be a string (or a single-element list of strings). Got type {type(candidate).__name__} for model={model}.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/bedrock/files/transformation.py:578 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass `input` as a string or a single-element list of strings."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}