BerriAI/litellm · error · HTTPException
Could not find index for endpoint with ID '{endpoint_id}'
Error message
Could not find index for endpoint with ID '{endpoint_id}' What it means
Raised during endpoint update when the endpoint with the given ID exists but its position in the stored list cannot be determined (id match fails while re-enumerating), so the list entry cannot be replaced in place.
Source
Thrown at litellm/proxy/pass_through_endpoints/pass_through_endpoints.py:3178
# Find the endpoint to update
found_endpoint: Final = _find_endpoint_by_id(pass_through_endpoint_data, endpoint_id)
if found_endpoint is None:
raise HTTPException(
status_code=404,
detail={"error": f"Endpoint with ID '{endpoint_id}' not found"},
)
# Find the index for updating the list
endpoint_index = None
for idx, endpoint in enumerate(pass_through_endpoint_data):
_endpoint = PassThroughGenericEndpoint(**endpoint) if isinstance(endpoint, dict) else endpoint
if _endpoint.id == endpoint_id:
endpoint_index = idx
break
if endpoint_index is None:
raise HTTPException(
status_code=404,
detail={"error": f"Could not find index for endpoint with ID '{endpoint_id}'"},
)
# Only merge fields the caller explicitly sent so omitted fields keep their
# stored value. Without exclude_unset, defaults like auth=True would overwrite
# an existing auth=false entry on any unrelated edit.
# Exclude is_from_config as it's a response-only field (computed at read time)
update_data: Final = data.model_dump(exclude_unset=True, exclude_none=True, exclude={"is_from_config"})
# Start with existing endpoint data
endpoint_dict: Final = found_endpoint.model_dump()
# Update with new data (only explicitly provided values)
endpoint_dict.update(update_data)
# Preserve existing ID if not provided in update and endpoint has ID
if "id" not in update_data and found_endpoint.id is not None:View on GitHub (pinned to 77b7c6c40c)
Solutions
- List pass-through endpoints to get valid IDs; the in-memory index may be stale after restart.
- Re-register the endpoint if its index entry is missing.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at litellm/proxy/pass_through_endpoints/pass_through_endpoints.py:3178 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/80159f003421739d.
Report an issue: GitHub.