BerriAI/litellm · error · ValueError
Invalid ARN format: {arn}
Error message
Invalid ARN format: {arn} What it means
Error "Invalid ARN format: {arn}" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/bedrock/chat/agentcore/transformation.py:177
returns: "arn:aws:bedrock-agentcore:us-west-2:888602223428:runtime/hosted_agent_r9jvp-3ySZuRHjLC"
"""
parts: Final = model.split("/", 1)
if len(parts) != 2 or parts[0] != "agentcore":
raise ValueError(
"Invalid model format. Expected format: 'model=bedrock/agentcore/arn:aws:bedrock-agentcore:region:account:runtime/runtime_id'"
)
return parts[1]
def _extract_region_from_arn(self, arn: str) -> str:
"""
Extract region from ARN
arn:aws:bedrock-agentcore:us-west-2:888602223428:runtime/hosted_agent_r9jvp-3ySZuRHjLC
returns: us-west-2
"""
parts: Final = arn.split(":")
if len(parts) >= 4:
return parts[3]
raise ValueError(f"Invalid ARN format: {arn}")
def _get_runtime_session_id(self, optional_params: dict) -> str:
"""
Get or generate runtime session ID (must be 33+ chars)
"""
session_id: Final = optional_params.get("runtimeSessionId", None)
if session_id:
verbose_logger.debug("Using provided runtimeSessionId: %s", session_id)
return session_id
# Generate a session ID with 33+ characters
generated_id: Final = f"litellm-session-{uuid.uuid4()}"
verbose_logger.debug("Generated new session ID: %s", generated_id)
return generated_id
def _get_runtime_user_id(self, optional_params: dict) -> str | None:
"""
Get runtime user ID if providedView on GitHub (pinned to 6c2dcb801b)
Solutions
- Pass a valid AgentCore ARN.
When it happens
Trigger: Thrown at litellm/llms/bedrock/chat/agentcore/transformation.py:177 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/a7ad26f75d090589.
Report an issue: GitHub.