BerriAI/litellm · error · ValueError

Invalid 'bedrock_tags' value. Expected a list of

Error message

Invalid 'bedrock_tags' value. Expected a list of {'key': <str>, 'value': <str>} dicts, e.g. [{'key': 'team', 'value': 'genai'}]. Got: {raw_tags!r}

What it means

Validation failure in _validate_bedrock_tags: the raw 'bedrock_tags' value failed pydantic adaptation into a list of {'key': str, 'value': str} dicts. The caller-supplied tags structure is the input at fault.

Solutions

  1. Pass bedrock_tags as a list of {'key': str, 'value': str} dicts, e.g. [{'key':'team','value':'genai'}].
  2. Ensure keys and values in bedrock_tags are strings.
  3. Remove or fix malformed entries in bedrock_tags.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/bedrock/batches/transformation.py:53 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/2da71e79c4e06625. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/bedrock/batches/transformation.py:53

)

# Bedrock batch input files are uploaded as
# s3://bucket/litellm-bedrock-files-{model, ":" -> "-"}-{uuid4}.jsonl (see
# BedrockFilesTransformation._get_s3_object_name). A uuid4 is always 36 hex/dash
# characters, so it can be stripped off the end unambiguously even though the
# model name itself may contain dashes.
_S3_BATCH_FILE_UUID_SUFFIX_PATTERN: Final = re.compile(
    r"-[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\.jsonl$"
)

_BEDROCK_TAGS_ADAPTER: Final[TypeAdapter[list[BedrockTag]]] = TypeAdapter(list[BedrockTag])


def _validate_bedrock_tags(raw_tags: object) -> list[BedrockTag]:
    try:
        return _BEDROCK_TAGS_ADAPTER.validate_python(raw_tags, strict=True)
    except ValidationError as e:
        raise ValueError(
            "Invalid 'bedrock_tags' value. Expected a list of {'key': <str>, 'value': <str>} dicts, "
            f"e.g. [{{'key': 'team', 'value': 'genai'}}]. Got: {raw_tags!r}"
        ) from e


class BedrockBatchesConfig(BaseAWSLLM, BaseBatchesConfig):
    """
    Config for Bedrock Batches - handles batch job creation and management for Bedrock
    """

    def __init__(self):
        super().__init__()
        self.common_utils = CommonBatchFilesUtils()

    @property
    def custom_llm_provider(self) -> LlmProviders:
        return LlmProviders.BEDROCK

View on GitHub (pinned to 77b7c6c40c)