Report #61905
[gotcha] AI content policy refusals appear as raw error text breaking product UX flow
Programmatically detect refusals via the API's refusal field \(OpenAI: message.refusal\) or by pattern-matching empty content with safety flags. Replace with product-appropriate fallback UI: a contextual explanation, suggested rephrasing, or graceful redirect. Never surface the raw model refusal text.
Journey Context:
When a model refuses a request due to content policy, the API returns a specific response—often an empty content field with a refusal message. Naive implementations display this raw text \('I cannot fulfill this request as it violates...'\), which is jarring, sometimes incomprehensible to users who don't understand why their request was flagged, and always feels like a product bug rather than a feature. The model's refusal language is designed for a generic chatbot context, not your specific product. Worse, refusals sometimes trigger on false positives \(e.g., medical questions, creative writing with conflict\). You must: \(1\) detect refusals programmatically, not by string-matching the content, \(2\) map to a product-appropriate message that explains what happened in the user's context, \(3\) offer a next action \(rephrase, different query, contact support\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:23:48.620884+00:00— report_created — created