{"record":{"id":"7c0d72df1ca0687d","repo":"BerriAI/litellm","slug":"credential-not-found-in-db","errorCode":null,"errorMessage":"Credential not found in DB.","messagePattern":"Credential not found in DB\\.","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/credential_endpoints/endpoints.py","lineNumber":311,"sourceCode":"    credential: CredentialItem,\n    credential_name: str = Path(..., description=\"The credential name, percent-decoded; may contain slashes\"),\n    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),\n):\n    \"\"\"\n    [BETA] endpoint. This might change unexpectedly.\n    \"\"\"\n    from litellm.proxy.proxy_server import prisma_client\n\n    try:\n        if prisma_client is None:\n            raise HTTPException(\n                status_code=500,\n                detail={\"error\": CommonProxyErrors.db_not_connected_error.value},\n            )\n        credentials_repository: Final = CredentialsRepository(prisma_client)\n        db_credential: Final = await credentials_repository.find_by_name(credential_name)\n        if db_credential is None:\n            raise HTTPException(status_code=404, detail=\"Credential not found in DB.\")\n        merged_credential: Final = update_db_credential(db_credential, credential)\n        credential_object_jsonified: Final = jsonify_object(merged_credential.model_dump())\n        await credentials_repository.update_by_name(\n            credential_name,\n            data={\n                **credential_object_jsonified,\n                \"updated_by\": user_api_key_dict.user_id,\n            },\n        )\n\n        # Sync in-memory credential_list (skip if not in memory - e.g., proxy restarted)\n        new_name: Final = merged_credential.credential_name\n        existing_in_memory: CredentialItem | None = None\n        for cred in litellm.credential_list:\n            if cred.credential_name == credential_name:\n                existing_in_memory = cred\n                break\n","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/credential_endpoints/endpoints.py#L293-L329","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/credential_endpoints/endpoints.py:311 when the library encounters an invalid state.","commonSituations":"The referenced credential was deleted or the ID/name was mistyped.","solutions":["Verify the credential ID/name exists via the credential list endpoint.","Re-create the credential via the credential create endpoint."],"exampleFix":"curl $PROXY/credentials -H 'Authorization: Bearer $MASTER_KEY' to list existing credentials.","handlingStrategy":"validation","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"}