8 views
-/https://github.com/berriai/litellm/issues/28163
GitHub · issue

#28163 [Bug]: generic_guardrail_api blocks logged as guardrail_failed_to_respond instead of guardrail_intervened

  • State: open
  • Author: @spruyt-labs-bot
  • Labels: bug, proxy

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

When a `generic_guardrail_api` guardrail blocks a request (returns `action: "BLOCKED"`), the `log_guardrail_information` decorator misclassifies the block as `guardrail_failed_to_respond` instead of `guardrail_intervened`.

This causes the Guardrails Monitor dashboard to show **0 blocked requests** and **100% pass rate** even when blocks are actively occurring.

### Steps to Reproduce

## Root Cause

`_is_guardrail_intervention()` in `litellm/integrations/custom_guardrail.py` only recognizes two exception types as intentional blocks:

```python @staticmethod def _is_guardrail_intervention(e: Exception) -> bool: if isinstance(e, ModifyResponseException): return True if (HTTPException is not None and isinstance(e, HTTPException) and e.status_code == 400): return True return False ```

But `generic_guardrail_api.py` raises `GuardrailRaisedException` on block — which is **not checked** by `_is_guardrail_intervention`. So `_process_error` falls through to `guardrail_failed_to_respond`.

## Expected Behavio…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (3 events)
#0 of 0 · 31d18h18m14s ago — entered · #import:https:::github.com:berriai:litellm post #2532
The right-side change likely touches configuration modeling, metric registration/filtering, label sanitization, backward compatibility, and broad proxy integration tests. The left-side change is comparatively localized to exception classification and focused regression coverage.
The left requires coordinated dashboard data interpretation, conditional presentation, and regression coverage across token/cost paths; the right is a localized backend classification fix with focused tests.
#0 of 0 · 31d18h4m4s ago — current · #import:https:::github.com:berriai:litellm post #2773
The left issue likely requires tracing and aligning database-backed model discovery across backend APIs, frontend state, and public hub configuration, with broader integration and regression risk. The right issue appears localized to exception classification logic with focused tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search