{"record":{"id":"0e4585c22b302c57","repo":"mlflow/mlflow","slug":"invalid-route-type-route-type-0e4585","errorCode":null,"errorMessage":"Invalid route type {route_type}","messagePattern":"Invalid route type (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mlflow/gateway/providers/togetherai.py","lineNumber":330,"sourceCode":"        return \"https://api.together.xyz/v1\"\n\n    @property\n    def headers(self):\n        return {\"Authorization\": f\"Bearer {self.togetherai_config.togetherai_api_key}\"}\n\n    @property\n    def adapter_class(self) -> type[ProviderAdapter]:\n        return TogetherAIAdapter\n\n    def get_endpoint_url(self, route_type: str) -> str:\n        if route_type == \"llm/v1/chat\":\n            return f\"{self.base_url}/chat/completions\"\n        elif route_type == \"llm/v1/completions\":\n            return f\"{self.base_url}/completions\"\n        elif route_type == \"llm/v1/embeddings\":\n            return f\"{self.base_url}/embeddings\"\n        else:\n            raise ValueError(f\"Invalid route type {route_type}\")\n\n    async def _request(self, path: str, payload: dict[str, Any]) -> dict[str, Any]:\n        return await send_request(\n            headers=self.headers,\n            base_url=self.base_url,\n            path=path,\n            payload=payload,\n        )\n\n    def _stream_request(self, path: str, payload: dict[str, Any]) -> AsyncGenerator[bytes, None]:\n        return send_stream_request(\n            headers=self.headers,\n            base_url=self.base_url,\n            path=path,\n            payload=payload,\n        )\n\n    async def _embeddings(","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/gateway/providers/togetherai.py#L312-L348","documentation":"TogetherAIProvider.get_endpoint_url maps only the three known route types ('llm/v1/chat/completions', 'llm/v1/completions', 'llm/v1/embeddings') to TogetherAI URLs; anything else raises ValueError('Invalid route type ...'). This is an internal guard — reaching it means get_endpoint_url was called directly with an unsupported route_type string.","triggerScenarios":"Calling provider.get_endpoint_url(\"llm/v1/embed\") or with a typo like \"llm/v1/chat\" directly; custom code invoking the provider outside the gateway's route dispatch.","commonSituations":"Hand-written tooling around providers; typos in route-type constants; new route types used with a provider that hasn't implemented them.","solutions":["Use one of the exact route types: 'llm/v1/chat/completions', 'llm/v1/completions', or 'llm/v1/embeddings'.","Fix typos in the route_type string (e.g. 'llm/v1/chat' -> 'llm/v1/chat/completions').","If you need a new route type, extend the provider instead of passing an ad-hoc string."],"exampleFix":"// before\nprovider.get_endpoint_url(\"llm/v1/chat\")\n// after\nprovider.get_endpoint_url(\"llm/v1/chat/completions\")","handlingStrategy":"validation","validationCode":"VALID_ROUTES = {\"llm/v1/chat/completions\", \"llm/v1/completions\", \"llm/v1/embeddings\"}\nif route_type not in VALID_ROUTES:\n    raise ValueError(f\"Unsupported route type: {route_type}\")","typeGuard":"def is_supported_route(route_type: str) -> bool:\n    return route_type in {\"llm/v1/chat/completions\", \"llm/v1/completions\", \"llm/v1/embeddings\"}","tryCatchPattern":"try:\n    url = provider.get_endpoint_url(route_type)\nexcept ValueError as e:\n    if \"Invalid route type\" in str(e):\n        route_type = ROUTE_ALIASES.get(route_type, \"llm/v1/chat/completions\")\n        url = provider.get_endpoint_url(route_type)\n    else:\n        raise","preventionTips":["Centralize route-type constants instead of inline strings","Spell route types exactly as documented","Add a lookup table mapping shorthand names to canonical route types"],"tags":["provider","validation","route-type"],"backgroundTag":"invalid-route-type","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}