BerriAI/litellm · error · ValueError

SemanticGuardrail: no routes configured. Provide route_templ

Error message

SemanticGuardrail: no routes configured. Provide route_templates or custom_routes.

What it means

Error "SemanticGuardrail: no routes configured. Provide route_templates or custom_routes." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py:81

            default_on=default_on,
            **kwargs,
        )

        self.guardrail_provider = "semantic_guard"
        self.embedding_model = embedding_model
        self.similarity_threshold = similarity_threshold
        self.on_flagged_action = on_flagged_action
        self.llm_router = llm_router

        routes: Final = SemanticGuardRouteLoader.build_routes(
            route_templates=route_templates,
            custom_routes_file=custom_routes_file,
            custom_routes=custom_routes,
            global_threshold=similarity_threshold,
        )

        if not routes:
            raise ValueError("SemanticGuardrail: no routes configured. Provide route_templates or custom_routes.")

        self.semantic_router: SemanticRouter = SemanticGuardRouteLoader.build_semantic_router(
            routes=routes,
            litellm_router=llm_router,
            embedding_model=embedding_model,
            global_threshold=similarity_threshold,
        )

        self.route_count = len(routes)
        verbose_logger.info(
            "SemanticGuardrail '%s' initialized with %s routes, embedding_model=%s, threshold=%s",
            guardrail_name,
            self.route_count,
            embedding_model,
            similarity_threshold,
        )

    @classmethod

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Configure route_templates or custom_routes for the SemanticGuardrail.
  2. Add at least one route the guardrail can match against.

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py:81 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/494e0a11a7a9aa4d. Report an issue: GitHub.