{"record":{"id":"a3a1aa8af92dcdd9","repo":"BerriAI/litellm","slug":"missing-required-valkey-configuration-provide-hos","errorCode":null,"errorMessage":"Missing required Valkey configuration. Provide host and port (or VALKEY_HOST/VALKEY_PORT), or pass redis_url.","messagePattern":"Missing required Valkey configuration\\. Provide host and port \\(or VALKEY_HOST/VALKEY_PORT\\), or pass redis_url\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/caching/valkey_semantic_cache.py","lineNumber":100,"sourceCode":"        self.key_prefix = f\"{self.index_name}:\"\n        self._index_dim: int | None = None\n\n        resolved_url = None\n        if sync_client is None or async_client is None:\n            resolved_url = redis_url or self._build_valkey_url(host, port, password, ssl)\n        self.sync_client = sync_client if sync_client is not None else Redis.from_url(resolved_url)\n        self.async_client = async_client if async_client is not None else AsyncRedis.from_url(resolved_url)\n\n        print_verbose(f\"Valkey semantic-cache initializing index - {self.index_name}\")\n\n    @staticmethod\n    def _build_valkey_url(host: str | None, port: str | None, password: str | None, ssl: bool = False) -> str:\n        host = host or os.environ.get(\"VALKEY_HOST\") or os.environ.get(\"REDIS_HOST\")\n        port = port or os.environ.get(\"VALKEY_PORT\") or os.environ.get(\"REDIS_PORT\")\n        password = password or os.environ.get(\"VALKEY_PASSWORD\") or os.environ.get(\"REDIS_PASSWORD\")\n\n        if not host or not port:\n            raise ValueError(\n                \"Missing required Valkey configuration. Provide host and port \"\n                \"(or VALKEY_HOST/VALKEY_PORT), or pass redis_url.\"\n            )\n\n        credentials: Final = f\":{password}@\" if password else \"\"\n        scheme: Final = \"rediss\" if ssl else \"redis\"\n        return f\"{scheme}://{credentials}{host}:{port}\"\n\n    @classmethod\n    def _scope_tag(cls, key: str) -> str:\n        # valkey-search TAG fields tokenize on punctuation and do not honour\n        # backslash escaping, so an arbitrary cache key cannot be matched\n        # verbatim. Hashing to hex yields a token that is always exact-match\n        # safe and still uniquely isolates a caller's scope.\n        return hashlib.sha256(str(key).encode(\"utf-8\")).hexdigest()\n\n    @staticmethod\n    def _embedding_to_bytes(embedding: list[float]) -> bytes:","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/caching/valkey_semantic_cache.py#L82-L118","documentation":"ValkeySemanticCache could not build a connection target: no redis_url was passed and host/port (or VALKEY_HOST/VALKEY_PORT env vars) were not resolvable via _build_valkey_url, so there is no endpoint to create the vector index on.","triggerScenarios":"Thrown at litellm/caching/valkey_semantic_cache.py:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide host and port (or set VALKEY_HOST/VALKEY_PORT), or pass a redis_url.","Verify the Valkey server is reachable at the configured address."],"exampleFix":null,"handlingStrategy":"validation","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-23T08:17:48.524Z"}