{"record":{"id":"494e0a11a7a9aa4d","repo":"BerriAI/litellm","slug":"semanticguardrail-no-routes-configured-provide-r","errorCode":null,"errorMessage":"SemanticGuardrail: no routes configured. Provide route_templates or custom_routes.","messagePattern":"SemanticGuardrail: no routes configured\\. Provide route_templates or custom_routes\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py","lineNumber":81,"sourceCode":"            default_on=default_on,\n            **kwargs,\n        )\n\n        self.guardrail_provider = \"semantic_guard\"\n        self.embedding_model = embedding_model\n        self.similarity_threshold = similarity_threshold\n        self.on_flagged_action = on_flagged_action\n        self.llm_router = llm_router\n\n        routes: Final = SemanticGuardRouteLoader.build_routes(\n            route_templates=route_templates,\n            custom_routes_file=custom_routes_file,\n            custom_routes=custom_routes,\n            global_threshold=similarity_threshold,\n        )\n\n        if not routes:\n            raise ValueError(\"SemanticGuardrail: no routes configured. Provide route_templates or custom_routes.\")\n\n        self.semantic_router: SemanticRouter = SemanticGuardRouteLoader.build_semantic_router(\n            routes=routes,\n            litellm_router=llm_router,\n            embedding_model=embedding_model,\n            global_threshold=similarity_threshold,\n        )\n\n        self.route_count = len(routes)\n        verbose_logger.info(\n            \"SemanticGuardrail '%s' initialized with %s routes, embedding_model=%s, threshold=%s\",\n            guardrail_name,\n            self.route_count,\n            embedding_model,\n            similarity_threshold,\n        )\n\n    @classmethod","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py#L63-L99","documentation":"Error \"SemanticGuardrail: no routes configured. Provide route_templates or custom_routes.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py:81 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Configure route_templates or custom_routes for the SemanticGuardrail.","Add at least one route the guardrail can match against."],"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-14T00:17:10.932Z"}