{"record":{"id":"36276e74f6dab87d","repo":"BerriAI/litellm","slug":"semantic-guard-violation","errorCode":"semantic_guard_violation","errorMessage":"Request blocked by semantic guardrail '{guardrail.guardrail_name}'. Matched route: {route_name}","messagePattern":"Request blocked by semantic guardrail '(.+?)'\\. Matched route: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py","lineNumber":235,"sourceCode":"\n    detection_info: Final = {\n        \"route_name\": route_name,\n        \"similarity_score\": similarity_score,\n        \"guardrail\": guardrail.guardrail_name,\n    }\n\n    verbose_logger.warning(\n        \"SemanticGuard match: route=%s, score=%s, action=%s\", route_name, similarity_score, guardrail.on_flagged_action\n    )\n\n    if guardrail.on_flagged_action == \"passthrough\":\n        guardrail.raise_passthrough_exception(\n            violation_message=violation_msg,\n            request_data=data,\n            detection_info=detection_info,\n        )\n    else:\n        raise HTTPException(  # pyright: ignore[reportOptionalCall]  # fastapi is installed wherever this proxy hook runs\n            status_code=400,\n            detail={\n                \"error\": violation_msg,\n                \"route\": route_name,\n                \"similarity_score\": similarity_score,\n                \"type\": \"semantic_guard_violation\",\n            },\n        )\n","sourceCodeStart":217,"sourceCodeEnd":244,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py#L217-L244","documentation":"Error \"Request blocked by semantic guardrail '{guardrail.guardrail_name}'. Matched route: {route_name}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py:235 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rephrase the request so it does not match the blocked semantic route.","Remove or adjust the matched route in the guardrail configuration if it blocks legitimate traffic."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}