BerriAI/litellm · error · ValueError

Tags must be a dict or list of {Key, Value} pairs

Error message

Tags must be a dict or list of {Key, Value} pairs

What it means

Input-shape validation when creating/putting a secret: the optional tags argument must be either a dict (key -> value) or an already-formed list of {Key, Value} pairs. Any other type (e.g. a string or tuple) is rejected before the AWS request is built.

Source

Thrown at litellm/secret_managers/aws_secret_manager_v2.py:283

        from litellm._uuid import uuid

        data: Final[dict[str, Any]] = {
            "Name": secret_name,
            "SecretString": secret_value,
            "ClientRequestToken": str(uuid.uuid4()),
        }

        if description:
            data["Description"] = description

        # ✅ Normalize tags to AWS format
        if tags:
            if isinstance(tags, dict):
                tags_list = [{"Key": k, "Value": str(v)} for k, v in tags.items()]
            elif isinstance(tags, list):
                tags_list = tags
            else:
                raise ValueError("Tags must be a dict or list of {Key, Value} pairs")
            data["Tags"] = tags_list

        endpoint_url, headers, body = self._prepare_request(
            action="CreateSecret",
            secret_name=secret_name,
            secret_value=secret_value,
            optional_params=optional_params,
            request_data=data,
        )

        async_client: Final = get_async_httpx_client(
            llm_provider=httpxSpecialProvider.SecretManager,
            params={"timeout": timeout},
        )

        try:
            response: Final = await async_client.post(
                url=endpoint_url,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass tags as a dict ({'Key':'Value'}) or a list of {'Key':..., 'Value':...} pairs.
  2. Normalize tag input before calling the AWS API so it matches boto3's expected shape.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/secret_managers/aws_secret_manager_v2.py:283 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/8c9d8ef272aeb00b. Report an issue: GitHub.