{"record":{"id":"97f869218ea64cef","repo":"BerriAI/litellm","slug":"litellm-params-api-base-must-use-http-or-https-sch","errorCode":null,"errorMessage":"litellm_params.api_base must use http or https scheme","messagePattern":"litellm_params\\.api_base must use http or https scheme","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_endpoints.py","lineNumber":736,"sourceCode":"                status_code=403,\n                detail=f\"You are not a member of team {team_id!r}\",\n            )\n\n    params: Final = request.get_litellm_params_dict()\n    if params.get(\"guardrail\") != GENERIC_GUARDRAIL_API:\n        raise HTTPException(\n            status_code=400,\n            detail=f\"Only guardrails with litellm_params.guardrail={GENERIC_GUARDRAIL_API!r} are accepted for registration\",\n        )\n    api_base: Final = params.get(\"api_base\")\n    if not api_base:\n        raise HTTPException(\n            status_code=400,\n            detail=\"litellm_params.api_base is required for generic_guardrail_api\",\n        )\n    parsed: Final = urlparse(api_base)\n    if parsed.scheme not in (\"http\", \"https\"):\n        raise HTTPException(\n            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:","sourceCodeStart":718,"sourceCodeEnd":754,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_endpoints.py#L718-L754","documentation":"Raised in the generic-guardrail registration handler when litellm_params.api_base parses with a scheme other than http/https (e.g. a bare host, websocket, or file URL). The guardrail will be called over HTTP, so the base URL must be an absolute web URL; this is the scheme-stage check — an earlier sibling verifies presence, the next one verifies hostname.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_endpoints.py:736 when the library encounters an invalid state.","commonSituations":"The guardrail api_base uses a non-HTTP scheme.","solutions":["Use an http:// or https:// URL for litellm_params.api_base."],"exampleFix":"api_base: https://guardrail.example.com","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"}