BerriAI/litellm · error · ValueError

Bedrock batch embedding requires one input per JSONL record.

Error message

Bedrock batch embedding requires one input per JSONL record. Got a list with {len(raw_input)} items for model={model}; emit one JSONL line per input string instead.

What it means

Error "Bedrock batch embedding requires one input per JSONL record. Got a list with {len(raw_input)} items for model={model}; emit one JSONL line per input string instead." thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/bedrock/files/transformation.py:558

          - Pre-tokenized inputs (List[int], List[List[int]]) -> NotImplementedError
          - Any other type -> ValueError

        Extracted so the validation can be exercised in isolation and so
        future embedding-provider branches (Titan G1, Cohere) can reuse it
        without duplicating the type-shaping logic.
        """
        if raw_input is None:
            raise ValueError(f"Embedding batch record is missing required `input` field: model={model}")

        # Bedrock InvokeModel for Titan v2 takes exactly one string `inputText`
        # per call. Pre-tokenized inputs and multi-element string lists are
        # explicitly unsupported so callers emit one JSONL line per embedding
        # instead of relying on us to silently fan out or concatenate.
        if isinstance(raw_input, list):
            if len(raw_input) == 1:
                candidate = raw_input[0]
            else:
                raise ValueError(
                    "Bedrock batch embedding requires one input per JSONL "
                    "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})."
            )

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Emit one JSONL line per input string instead of a list per record.

When it happens

Trigger: Thrown at litellm/llms/bedrock/files/transformation.py:558 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/7387d7f1b6004aef. Report an issue: GitHub.