BerriAI/litellm · critical · Exception
An error occurred: {str(e)}, banned_keywords_list={banned_ke
Error message
An error occurred: {str(e)}, banned_keywords_list={banned_keywords_list} What it means
LiteLLM re-threw an 'authorization denied for' error from an OpenAI-compatible provider (the custom_llm_provider named in the message, e.g. Predibase) as AuthenticationError. Notably, the mapper actively scrubs bearer tokens out of the message before raising, because some providers (Predibase specifically) echo the raw API key back in the error body.
Source
Thrown at enterprise/enterprise_hooks/banned_keywords.py:46
if banned_keywords_list is None:
raise Exception(
"`banned_keywords_list` can either be a list or filepath. None set."
)
if isinstance(banned_keywords_list, list):
self.banned_keywords_list = banned_keywords_list
if isinstance(banned_keywords_list, str): # assume it's a filepath
try:
with open(banned_keywords_list, "r") as file:
data = file.read()
self.banned_keywords_list = data.split("\n")
except FileNotFoundError:
raise Exception(
f"File not found. banned_keywords_list={banned_keywords_list}"
)
except Exception as e:
raise Exception(
f"An error occurred: {str(e)}, banned_keywords_list={banned_keywords_list}"
)
def print_verbose(self, print_statement, level: Literal["INFO", "DEBUG"] = "DEBUG"):
if level == "INFO":
verbose_proxy_logger.info(print_statement)
elif level == "DEBUG":
verbose_proxy_logger.debug(print_statement)
if litellm.set_verbose is True:
print(print_statement) # noqa
def test_violation(self, test_str: str):
for word in self.banned_keywords_list:
if word in test_str.lower():
raise HTTPException(
status_code=400,
detail={"error": f"Keyword banned. Keyword={word}"},View on GitHub (pinned to 6c2dcb801b)
Solutions
- Verify the token belongs to the same tenant/organization that owns the model or deployment.
- Confirm the token has inference permissions, not just dataset/read access.
- Check model/deployment names for typos - authorization failures often mask missing resources.
- Never log the raw exception from the provider; rely on LiteLLM's already-scrubbed message.
Example fix
# before
r = litellm.completion(model="predibase/my-llama3", messages=msgs) # authorization denied
# after: use tenant-correct key and explicit deployment
r = litellm.completion(
model="predibase/my-deployment/8b-instruct",
messages=msgs,
api_key=os.environ["PREDIBASE_API_KEY"], # token from the owning tenant
api_base=os.environ.get("PREDIBASE_API_BASE"),
) Defensive patterns
Strategy: try-catch
Validate before calling
import os
if not os.environ.get("PREDIBASE_API_KEY"):
raise RuntimeError("PREDIBASE_API_KEY required for predibase models") Type guard
def is_authorization_denied(e: BaseException) -> bool:
return isinstance(e, litellm.AuthenticationError) and "authorization denied" in str(e) Try / catch
try:
r = litellm.completion(model="predibase/my-model", messages=msgs)
except litellm.AuthenticationError as e:
# message is already bearer-scrubbed by litellm; safe to log
logger.error("predibase authz denied: %s", e.message)
raise Prevention
- Ensure the API token belongs to the tenant that owns the model/deployment.
- Log only the LiteLLM exception message - some providers echo raw bearer tokens in errors.
- Verify resource names; authorization failures often hide nonexistent deployments.
When it happens
Trigger: Calling an OpenAI-compatible provider (e.g. predibase/*) with a token lacking permission for the target model/fine-tune/deployment; wrong tenant token; a bearer key valid but not authorized for that specific resource.
Common situations: Using a Predibase key from one organization against another's deployments; token has read but not inference scope; resource name typo causing an authorization check against a nonexistent deployment; secret leakage concern because the provider echoes keys.
Related errors
- Error: {response.status_code} - {response.text}
- Missing Authorization header
- Invalid bearer token
- Invalid API key
- Prompt '{prompt_id}' not found
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/95573757177dfc72.
Report an issue: GitHub.