BerriAI/litellm · error · ValueError

Input type '{input_type}' requires async_invoke route. Use m

Error message

Input type '{input_type}' requires async_invoke route. Use model format: 'bedrock/async_invoke/model_id'

What it means

TwelveLabs Marengo embedding transformations accept video/audio (and S3-URL media) inputs only through Bedrock's asynchronous invoke route. _transform_request checks inputType and refuses video/audio when the model string does not carry the 'async_invoke/' prefix, because the synchronous invoke endpoint cannot process them.

Source

Thrown at litellm/llms/bedrock/embed/twelvelabs_marengo_transformation.py:99

        """
        Transform OpenAI-style input to TwelveLabs Marengo format/async-invoke format.

        Supports:
        - Text inputs (for both invoke and async-invoke)
        - Image inputs (for both invoke and async-invoke)
        - Video inputs (async-invoke only)
        - Audio inputs (async-invoke only)
        - S3 URLs for all media types (async-invoke only)
        """
        # Get input_type or default to "text"
        input_type: Final = cast(
            TWELVELABS_EMBEDDING_INPUT_TYPES,
            inference_params.get("inputType") or inference_params.get("input_type") or "text",
        )

        # Validate that async-invoke is used for video/audio
        if input_type in ["video", "audio"] and not async_invoke_route:
            raise ValueError(
                f"Input type '{input_type}' requires async_invoke route. "
                f"Use model format: 'bedrock/async_invoke/model_id'"
            )

        transformed_request: Final[TwelveLabsMarengoEmbeddingRequest] = {"inputType": input_type}

        if input_type == "text":
            transformed_request["inputText"] = input
            # Set default textTruncate if not specified
            if "textTruncate" not in inference_params:
                transformed_request["textTruncate"] = "end"

        elif input_type in ["image", "video", "audio"]:
            if self._is_s3_url(input):
                # S3 URL input
                s3_location: Final[TwelveLabsS3Location] = {"uri": input}
                bucket_owner: Final = self._extract_bucket_owner_from_params(inference_params)
                if bucket_owner:

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Prefix the model with the async route: 'bedrock/async_invoke/twelvelabs.marengo-embed-2.7'.
  2. For text embeddings, keep input_type='text' (or omit it) on the normal model string.
  3. Provide output_s3_uri when using the async route (see error 1271).

Example fix

# before
litellm.embedding(model="bedrock/twelvelabs.marengo-embed-2.7", input=[video_url], input_type="video")

# after
litellm.embedding(
    model="bedrock/async_invoke/twelvelabs.marengo-embed-2.7",
    input=[video_url],
    input_type="video",
    output_s3_uri="s3://my-bucket/out/",
)
Defensive patterns

Strategy: validation

Validate before calling

def validate_marengo_call(model: str, input_type: str | None):
    it = input_type or "text"
    if it in ("video", "audio") and not model.startswith("bedrock/async_invoke/"):
        raise ValueError(f"{it} requires bedrock/async_invoke/ model prefix")

Type guard

def needs_async_route(input_type: str | None) -> bool:
    return (input_type or "text") in ("video", "audio")

Prevention

When it happens

Trigger: Calling litellm.embedding(model='bedrock/twelvelabs.marengo-embed-2.7', input=..., input_type='video') without the async route prefix; likewise for input_type='audio' or S3 media URLs passed on the sync path.

Common situations: Copying the sync text-embedding call shape and only switching inputType to video/audio; forgetting that the async route is opt-in via model string, not a parameter.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/1d6f9eeee02989de. Report an issue: GitHub.