BerriAI/litellm · error · ValueError
Invalid batch_id format. Expected ARN, got: {batch_id}
Error message
Invalid batch_id format. Expected ARN, got: {batch_id} What it means
Error "Invalid batch_id format. Expected ARN, got: {batch_id}" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/bedrock/batches/transformation.py:375
batch_id: str,
optional_params: dict,
litellm_params: dict,
) -> dict[str, Any]:
"""
Transform batch retrieval request for Bedrock.
Args:
batch_id: Bedrock job ARN
optional_params: Optional parameters
litellm_params: LiteLLM parameters
Returns:
Transformed request data for Bedrock GetModelInvocationJob API
"""
# For Bedrock, batch_id should be the full job ARN
# The GetModelInvocationJob API expects the full ARN as the identifier
if not batch_id.startswith("arn:aws:bedrock:"):
raise ValueError(f"Invalid batch_id format. Expected ARN, got: {batch_id}")
# Extract the job identifier from the ARN - use the full ARN path part
# ARN format: arn:aws:bedrock:region:account:model-invocation-job/job-name
arn_parts: Final = batch_id.split(":")
if len(arn_parts) < 6:
raise ValueError(f"Invalid ARN format: {batch_id}")
region: Final = arn_parts[3]
if not re.match(r"^[a-z][a-z0-9-]*$", region):
raise ValueError(f"Invalid region in ARN: {batch_id}")
# Build the endpoint URL for GetModelInvocationJob
# AWS API format: GET /model-invocation-job/{jobIdentifier}
# Use the FULL ARN as jobIdentifier and URL-encode it (includes ':' and '/')
import urllib.parse as _ul
encoded_arn: Final = _ul.quote(batch_id, safe="")
endpoint_url: Final = f"https://bedrock.{region}.amazonaws.com/model-invocation-job/{encoded_arn}"View on GitHub (pinned to 6c2dcb801b)
Solutions
- Pass the batch_id as a full Bedrock batch job ARN.
When it happens
Trigger: Thrown at litellm/llms/bedrock/batches/transformation.py:375 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/fe2ab1586964d64b.
Report an issue: GitHub.