{"record":{"id":"2c93eeb10981e6f3","repo":"BerriAI/litellm","slug":"semanticguard-custom-routes-file-not-found-file","errorCode":null,"errorMessage":"SemanticGuard: custom routes file not found: {file_path}","messagePattern":"SemanticGuard: custom routes file not found: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/semantic_guard/route_loader.py","lineNumber":55,"sourceCode":"            )\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]]:\n        \"\"\"Load custom routes from a YAML file.\"\"\"\n        if not os.path.exists(file_path):\n            raise ValueError(f\"SemanticGuard: custom routes file not found: {file_path}\")\n        with open(file_path, \"r\") as f:\n            data: Final = yaml.safe_load(f)\n        if isinstance(data, list):\n            return data\n        if isinstance(data, dict):\n            return [data]\n        raise ValueError(f\"SemanticGuard: invalid custom routes file format in {file_path}\")\n\n    @classmethod\n    def build_routes(\n        cls,\n        route_templates: list[str] | None,\n        custom_routes_file: str | None,\n        custom_routes: list[dict[str, Any]] | None,\n        global_threshold: float = DEFAULT_SEMANTIC_GUARD_SIMILARITY_THRESHOLD,\n    ) -> list[\"Route\"]:\n        \"\"\"Build semantic-router Route objects from templates + custom config.\"\"\"\n        from semantic_router.routers.base import Route","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/semantic_guard/route_loader.py#L37-L73","documentation":"Error \"SemanticGuard: custom routes file not found: {file_path}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/semantic_guard/route_loader.py:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the custom routes file_path exists and is readable by the proxy process.","Use an absolute path or a path relative to the proxy working directory."],"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"}