BerriAI/litellm · error · ValueError
'model' keyword not found and unable to extract model from e
Error message
'model' keyword not found and unable to extract model from endpoint. Expected format: /model/{modelId}/{action}. Got: {endpoint} What it means
Bedrock model-ID extraction helper failed: the endpoint path contains neither a literal 'model' path segment nor any known BEDROCK_ENDPOINT_ACTIONS segment from which the model ID could be inferred, so the path does not match the expected /model/{modelId}/{action} shape. Thrown as ValueError during URL parsing before any request is sent.
Source
Thrown at litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py:680
break
# If "model" keyword not found, try to extract model from the endpoint
# by finding the action and taking everything before it
if model_index is None:
# Find the index of the action in the endpoint parts
action_index = None
for idx, part in enumerate(endpoint_parts):
if part in BEDROCK_ENDPOINT_ACTIONS:
action_index = idx
break
if action_index is not None and action_index > 1:
# Join all parts before the action (excluding empty strings)
model_parts = [p for p in endpoint_parts[1:action_index] if p]
if model_parts:
return "/".join(model_parts)
raise ValueError(
f"'model' keyword not found and unable to extract model from endpoint. Expected format: /model/{{modelId}}/{{action}}. Got: {endpoint}"
)
# Find the index of the action in the endpoint parts
action_index = None
for idx, part in enumerate(endpoint_parts):
if part in BEDROCK_ENDPOINT_ACTIONS:
action_index = idx
break
if action_index is not None and action_index > model_index + 1:
# Join all parts between "model" and the action (excluding "model" itself)
return "/".join(endpoint_parts[model_index + 1 : action_index])
# Fallback to taking everything after "model" if no action found
model_parts = [p for p in endpoint_parts[model_index + 1 :] if p]
if model_parts:
return "/".join(model_parts)View on GitHub (pinned to 77b7c6c40c)
Solutions
- Format the Bedrock pass-through endpoint as /model/{modelId}/{action}, e.g. /model/anthropic.claude-v2/invoke.
- URL-encode the model ID if it contains slashes (use %2F).
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py:680 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/1ab1070cff334686.
Report an issue: GitHub.