BerriAI/litellm · error · ValueError
Bedrock batch embedding `input` must be a string (or a singl
Error message
Bedrock batch embedding `input` must be a string (or a single-element list of strings). Got type {type(candidate).__name__} for model={model}. What it means
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.
Source
Thrown at litellm/llms/bedrock/files/transformation.py:578
"record. Got a list with "
f"{len(raw_input)} items for model={model}; emit one "
"JSONL line per input string instead."
)
else:
candidate = raw_input
# Catches pre-tokenized inputs (List[int] from OpenAI spec, or a
# single int slipping past the list-unwrap above).
# NOTE: bool is a subclass of int but treating True/False as a token
# is meaningless either way, so the broad check is fine.
if isinstance(candidate, (list, int)):
raise NotImplementedError(
"Bedrock Titan v2 batch embedding does not support "
"pre-tokenized integer inputs. Pass `input` as a string "
f"(model={model})."
)
if not isinstance(candidate, str):
raise ValueError(
"Bedrock batch embedding `input` must be a string (or a "
"single-element list of strings). Got type "
f"{type(candidate).__name__} for model={model}."
)
return candidate
def _map_openai_embedding_to_bedrock_params(
self,
openai_request_body: _OpenAIBatchRecordBody,
model: str,
) -> dict[str, object]:
"""
Transform an OpenAI /v1/embeddings request body into the
Bedrock InvokeModel `modelInput` for embedding models that AWS
supports via batch inference (CreateModelInvocationJob).
Currently routes Amazon Titan Text Embeddings V2 only; other
embedding providers (Titan G1, Titan Multimodal, Cohere Embed,View on GitHub (pinned to 6c2dcb801b)
Solutions
- Pass `input` as a string or a single-element list of strings.
When it happens
Trigger: Thrown at litellm/llms/bedrock/files/transformation.py:578 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/38cd0e726c0aad7a.
Report an issue: GitHub.