{"record":{"id":"82987ccace73a890","repo":"BerriAI/litellm","slug":"missing-required-redis-configuration-missing-var","errorCode":null,"errorMessage":"Missing required Redis configuration: {missing_var}. Provide {missing_var} or redis_url.","messagePattern":"Missing required Redis configuration: (.+?)\\. Provide (.+?) or redis_url\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/caching/redis_semantic_cache.py","lineNumber":100,"sourceCode":"        self.similarity_threshold = similarity_threshold\n\n        # Convert similarity threshold [0,1] to distance threshold [0,2]\n        # For cosine distance: 0 = most similar, 2 = least similar\n        # While similarity: 1 = most similar, 0 = least similar\n        self.distance_threshold = 1 - similarity_threshold\n        self.embedding_model = embedding_model\n\n        # Set up Redis connection\n        if redis_url is None:\n            try:\n                # Attempt to use provided parameters or fallback to environment variables\n                host = host or os.environ[\"REDIS_HOST\"]\n                port = port or os.environ[\"REDIS_PORT\"]\n                password = password or os.environ[\"REDIS_PASSWORD\"]\n            except KeyError as e:\n                # Raise a more informative exception if any of the required keys are missing\n                missing_var: Final = e.args[0]\n                raise ValueError(\n                    f\"Missing required Redis configuration: {missing_var}. Provide {missing_var} or redis_url.\"\n                ) from e\n\n            redis_url = f\"redis://:{password}@{host}:{port}\"\n\n        print_verbose(f\"Redis semantic-cache redis_url: {redis_url}\")\n\n        # Defer redisvl index construction until first use. redisvl's\n        # CustomTextVectorizer eagerly embeds a probe string at construction;\n        # building lazily ensures that probe runs after llm_router is wired so\n        # per-deployment auth (e.g. Bedrock aws_role_name) is applied.\n        self._index_name = index_name\n        self._redis_url = redis_url\n        self._llmcache = None\n\n    @property\n    def llmcache(self) -> object:\n        if getattr(self, \"_llmcache\", None) is None:","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/caching/redis_semantic_cache.py#L82-L118","documentation":"RedisSemanticCache connection setup found neither a redis_url nor the required Redis environment variable (e.g. REDIS_HOST); the message names the exact missing variable so the caller knows whether to pass it directly or supply a full URL.","triggerScenarios":"Thrown at litellm/caching/redis_semantic_cache.py:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the missing Redis configuration variable named in the error, or pass a single redis_url.","Set REDIS_HOST/REDIS_PORT (and REDIS_PASSWORD if needed) in the environment, or configure redis_url directly."],"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"}