{"record":{"id":"93161c4f407d9a5b","repo":"BerriAI/litellm","slug":"semanticguard-unknown-route-template-template-n","errorCode":null,"errorMessage":"SemanticGuard: unknown route template '{template_name}'. Available templates: {SemanticGuardRouteLoader.list_builtin_templates()}","messagePattern":"SemanticGuard: unknown route template '(.+?)'\\. Available templates: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/semantic_guard/route_loader.py","lineNumber":34,"sourceCode":"if TYPE_CHECKING:\n    from semantic_router.routers import SemanticRouter\n    from semantic_router.routers.base import Route\n\n    from litellm.router import Router\n\n\nROUTE_TEMPLATES_DIR: Final = os.path.join(os.path.dirname(__file__), \"route_templates\")\n\n\nclass SemanticGuardRouteLoader:\n    \"\"\"Loads route definitions from YAML templates and custom configs, builds SemanticRouter.\"\"\"\n\n    @staticmethod\n    def load_builtin_template(template_name: str) -> dict[str, Any]:\n        \"\"\"Load a built-in route template YAML by name.\"\"\"\n        file_path: Final = os.path.join(ROUTE_TEMPLATES_DIR, f\"{template_name}.yaml\")\n        if not os.path.exists(file_path):\n            raise ValueError(\n                f\"SemanticGuard: unknown route template '{template_name}'. \"\n                f\"Available templates: {SemanticGuardRouteLoader.list_builtin_templates()}\"\n            )\n        with open(file_path, \"r\") as f:\n            return yaml.safe_load(f)\n\n    @staticmethod\n    def list_builtin_templates() -> list[str]:\n        \"\"\"List available built-in template names.\"\"\"\n        templates: Final = []\n        if os.path.isdir(ROUTE_TEMPLATES_DIR):\n            for fname in os.listdir(ROUTE_TEMPLATES_DIR):\n                if fname.endswith(\".yaml\"):\n                    templates.append(fname.replace(\".yaml\", \"\"))\n        return sorted(templates)\n\n    @staticmethod\n    def load_custom_routes_file(file_path: str) -> list[dict[str, Any]]:","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/semantic_guard/route_loader.py#L16-L52","documentation":"Error \"SemanticGuard: unknown route template '{template_name}'. Available templates: {SemanticGuardRouteLoader.list_builtin_templates()}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/semantic_guard/route_loader.py:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the available built-in route templates listed in the error message.","Define the route in a custom routes file instead of referencing an unknown template."],"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"}