{"record":{"id":"10c1259728fe6c8e","repo":"BerriAI/litellm","slug":"guardrail-with-name-request-guardrail-name-r-alr","errorCode":null,"errorMessage":"Guardrail with name {request.guardrail_name!r} already exists","messagePattern":"Guardrail with name (.+?) already exists","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_endpoints.py","lineNumber":755,"sourceCode":"            status_code=400,\n            detail=\"litellm_params.api_base must use http or https scheme\",\n        )\n    if not parsed.hostname:\n        raise HTTPException(\n            status_code=400,\n            detail=\"litellm_params.api_base must contain a valid hostname\",\n        )\n    mode: Final = params.get(\"mode\")\n    if mode is None:\n        raise HTTPException(\n            status_code=400,\n            detail=\"litellm_params.mode is required (e.g. pre_call, post_call)\",\n        )\n\n    try:\n        existing = await _guardrails_table(prisma_client).find_unique(where={\"guardrail_name\": request.guardrail_name})\n        if existing is not None:\n            raise HTTPException(\n                status_code=400,\n                detail=f\"Guardrail with name {request.guardrail_name!r} already exists\",\n            )\n    except HTTPException:\n        raise\n    except Exception as e:\n        verbose_proxy_logger.exception(\"Error checking guardrail name uniqueness: %s\", e)\n        raise HTTPException(status_code=500, detail=str(e))\n\n    now: Final = datetime.now(timezone.utc)\n    litellm_params_str: Final = safe_dumps(params)\n    guardrail_info: Final = dict(request.guardrail_info or {})\n    guardrail_info[\"submitted_by_user_id\"] = user_api_key_dict.user_id\n    guardrail_info[\"submitted_by_email\"] = user_api_key_dict.user_email\n    guardrail_info[\"team_guardrail\"] = True  # Mark as team submission for filtering/display\n    guardrail_info_str: Final = safe_dumps(guardrail_info)\n\n    try:","sourceCodeStart":737,"sourceCodeEnd":773,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_endpoints.py#L737-L773","documentation":"Raised during generic-guardrail registration when a database lookup finds an existing guardrail row with the same guardrail_name. Guardrail names are unique keys in the registry and DB, so a duplicate registration is rejected with HTTP 400 rather than silently overwriting the existing guardrail's configuration.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_endpoints.py:755 when the library encounters an invalid state.","commonSituations":"A guardrail with the same name already exists.","solutions":["Choose a different guardrail_name, or update/delete the existing guardrail with that name."],"exampleFix":"Use a unique guardrail_name in the create request.","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-14T05:17:10.506Z"}