Report #57656
[gotcha] AI refusals return as HTTP 200 with refusal text in content — error handling code never triggers, raw refusal displayed in UI
Implement content-based refusal detection as a separate validation layer after receiving the API response. Check for finish\_reason='content\_filter', scan response content for common refusal patterns \('I cannot', 'I'm not able to', 'As an AI'\), and route these to designed UX fallback states instead of rendering raw refusal text.
Journey Context:
Standard API integration uses HTTP status codes for error handling: 4xx/5xx triggers error states, 200 triggers success. But AI refusals — from content policy, safety filters, or the model's own judgment — return as HTTP 200 OK with the refusal as the response content. Your error handling code never fires. The raw refusal text \('I cannot fulfill this request as it violates...'\) gets rendered directly in your product UI, looking broken at best and hostile at worst. This is especially damaging in consumer products where the model's internal refusal language is not user-facing copy. The fix requires a secondary validation layer: after any 200 response, inspect the content for refusal signals and route to properly designed UX states with human-friendly messaging.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:15:50.816838+00:00— report_created — created