BerriAI/litellm · error · HTTPException
Credential not found in DB.
Error message
Credential not found in DB.
What it means
The credential lookup by (percent-decoded) name found no DB row; the delete/get operation cannot proceed. Existence check after the repository query, distinct from the DB-not-connected guard above it.
Source
Thrown at litellm/proxy/credential_endpoints/endpoints.py:311
credential: CredentialItem,
credential_name: str = Path(..., description="The credential name, percent-decoded; may contain slashes"),
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
"""
[BETA] endpoint. This might change unexpectedly.
"""
from litellm.proxy.proxy_server import prisma_client
try:
if prisma_client is None:
raise HTTPException(
status_code=500,
detail={"error": CommonProxyErrors.db_not_connected_error.value},
)
credentials_repository: Final = CredentialsRepository(prisma_client)
db_credential: Final = await credentials_repository.find_by_name(credential_name)
if db_credential is None:
raise HTTPException(status_code=404, detail="Credential not found in DB.")
merged_credential: Final = update_db_credential(db_credential, credential)
credential_object_jsonified: Final = jsonify_object(merged_credential.model_dump())
await credentials_repository.update_by_name(
credential_name,
data={
**credential_object_jsonified,
"updated_by": user_api_key_dict.user_id,
},
)
# Sync in-memory credential_list (skip if not in memory - e.g., proxy restarted)
new_name: Final = merged_credential.credential_name
existing_in_memory: CredentialItem | None = None
for cred in litellm.credential_list:
if cred.credential_name == credential_name:
existing_in_memory = cred
break
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Verify the credential ID/name exists via the credential list endpoint.
- Re-create the credential via the credential create endpoint.
Example fix
curl $PROXY/credentials -H 'Authorization: Bearer $MASTER_KEY' to list existing credentials.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/credential_endpoints/endpoints.py:311 when the library encounters an invalid state.
Common situations: The referenced credential was deleted or the ID/name was mistyped.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/7c0d72df1ca0687d.
Report an issue: GitHub.