BerriAI/litellm · error · HTTPException
Content blocked: competitor comparison or ranking intent det
Error message
Content blocked: competitor comparison or ranking intent detected.
What it means
Raised by the litellm_content_filter guardrail when its competitor-intent classifier labels the request as competitor comparison/ranking content and the checker's action_hint is 'refuse'. Instead of forwarding the prompt to the model, the proxy raises HTTPException 400 carrying the detected intent, confidence, and message. The user-facing message can be overridden via the checker's refuse_message_template, but the block itself is policy.
Source
Thrown at litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py:1667
detection: Final[CompetitorIntentDetection] = {
"type": "competitor_intent",
"intent": intent_val,
"confidence": confidence_val,
"action_hint": action_hint_val,
"entities": intent_result.get("entities", {}),
"signals": intent_result.get("signals", []),
"evidence": [dict(e) for e in evidence_list],
}
detections.append(detection)
if action_hint_val == "refuse":
msg = "Content blocked: competitor comparison or ranking intent detected."
if self._competitor_intent_checker and getattr(
self._competitor_intent_checker, "refuse_message_template", None
):
msg = self._competitor_intent_checker.refuse_message_template or msg
verbose_proxy_logger.warning("ContentFilterGuardrail: competitor intent refuse - %s", intent_val)
raise HTTPException(
status_code=400,
detail={
"error": msg,
"intent": intent_val,
"confidence": confidence_val,
},
)
if action_hint_val == "reframe":
msg = (
"I can help with questions about our products and services. "
"Would you like to compare specific features or get more information?"
)
if self._competitor_intent_checker and getattr(
self._competitor_intent_checker, "reframe_message_template", None
):
msg = self._competitor_intent_checker.reframe_message_template or msg
verbose_proxy_logger.info("ContentFilterGuardrail: competitor intent reframe - %s", intent_val)
self.raise_passthrough_exception(View on GitHub (pinned to 77b7c6c40c)
Solutions
- Rephrase the prompt to ask only about your own products and features instead of comparing or ranking against named competitors
- Tune the competitor intent checker configuration (competitor entity list, confidence threshold, intent-to-action mapping) so borderline prompts get 'reframe' or 'allow' instead of 'refuse'
- Set refuse_message_template on the competitor intent checker so blocked users receive actionable guidance instead of the generic message
- If competitor blocking is not wanted for this deployment, remove the competitor intent checker from the guardrail config or scope the guardrail with mode/metadata so it does not run
Example fix
// before - user prompt that triggers the refuse action "Compare LiteLLM vs Portkey vs Helicone - which one is best?" // after - prompt about your own product only, passes the guardrail "What features does LiteLLM provide for proxying, guardrails, and cost tracking?"
Defensive patterns
Strategy: try-catch
Validate before calling
COMPETITORS = {"portkey", "helicone", "openrouter"}
def likely_competitor_refusal(prompt: str) -> bool:
p = prompt.lower()
return any(c in p for c in COMPETITORS) and any(
w in p for w in (" vs ", "versus", "compare", "better", "rank", "top ")
)
if likely_competitor_refusal(user_prompt):
user_prompt = rephrase_to_own_products(user_prompt) Try / catch
import openai, json
try:
resp = client.chat.completions.create(model=deployment, messages=msgs)
except openai.BadRequestError as e:
detail = e.body.get("error", "") if isinstance(e.body, dict) else str(e.body)
if "competitor comparison or ranking intent" in detail:
return reframe_question_for_user(msgs)
raise Prevention
- Keep the competitor entity list and confidence threshold in the guardrail config in sync with what your users actually ask
- Set refuse_message_template so blocked users get guidance instead of a dead end
- Prefer 'reframe' over 'refuse' for medium-confidence detections to reduce false-positive friction
When it happens
Trigger: A /chat/completions (or similar) call routed through a deployment with the content filter guardrail attached (default_on or via metadata guardrails), where the prompt asks to compare/rank the company's products against named competitors and the competitor intent checker returns action_hint='refuse' with its confidence threshold met.
Common situations: Customer-facing chatbots with competitor-intent blocking enabled; brand-safety guardrails that refuse 'X vs Y' or 'top 10 providers' questions; false positives on neutral comparative questions like 'compare your two pricing plans'; policy tuned so aggressively that legitimate feature questions get refused.
Related errors
- Content blocked: {context_label} argument matched a masking
- Content blocked: {context_label} arguments exceed the maximu
- {violation_message}
- Sensitive data detected by {self.guardrail_name} (routing sk
- Sensitive data detected by {self.guardrail_name}
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/a47832aa70bd809e.
Report an issue: GitHub.