{"record":{"id":"80159f003421739d","repo":"BerriAI/litellm","slug":"could-not-find-index-for-endpoint-with-id-endpoi","errorCode":null,"errorMessage":"Could not find index for endpoint with ID '{endpoint_id}'","messagePattern":"Could not find index for endpoint with ID '(.+?)'","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/pass_through_endpoints/pass_through_endpoints.py","lineNumber":3178,"sourceCode":"    # Find the endpoint to update\n    found_endpoint: Final = _find_endpoint_by_id(pass_through_endpoint_data, endpoint_id)\n\n    if found_endpoint is None:\n        raise HTTPException(\n            status_code=404,\n            detail={\"error\": f\"Endpoint with ID '{endpoint_id}' not found\"},\n        )\n\n    # Find the index for updating the list\n    endpoint_index = None\n    for idx, endpoint in enumerate(pass_through_endpoint_data):\n        _endpoint = PassThroughGenericEndpoint(**endpoint) if isinstance(endpoint, dict) else endpoint\n        if _endpoint.id == endpoint_id:\n            endpoint_index = idx\n            break\n\n    if endpoint_index is None:\n        raise HTTPException(\n            status_code=404,\n            detail={\"error\": f\"Could not find index for endpoint with ID '{endpoint_id}'\"},\n        )\n\n    # Only merge fields the caller explicitly sent so omitted fields keep their\n    # stored value. Without exclude_unset, defaults like auth=True would overwrite\n    # an existing auth=false entry on any unrelated edit.\n    # Exclude is_from_config as it's a response-only field (computed at read time)\n    update_data: Final = data.model_dump(exclude_unset=True, exclude_none=True, exclude={\"is_from_config\"})\n\n    # Start with existing endpoint data\n    endpoint_dict: Final = found_endpoint.model_dump()\n\n    # Update with new data (only explicitly provided values)\n    endpoint_dict.update(update_data)\n\n    # Preserve existing ID if not provided in update and endpoint has ID\n    if \"id\" not in update_data and found_endpoint.id is not None:","sourceCodeStart":3160,"sourceCodeEnd":3196,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py#L3160-L3196","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/pass_through_endpoints/pass_through_endpoints.py:3178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}