{"record":{"id":"8e3411e414dbe98e","repo":"chroma-core/chroma","slug":"the-self-api-key-env-var-environment-variable-is-8e3411","errorCode":null,"errorMessage":"The {self.api_key_env_var} environment variable is not set.","messagePattern":"The (.+?) environment variable is not set\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/huggingface_embedding_function.py","lineNumber":50,"sourceCode":"        except ImportError:\n            raise ValueError(\n                \"The httpx python package is not installed. Please install it with `pip install httpx`\"\n            )\n\n        if api_key is not None:\n            warnings.warn(\n                \"Direct api_key configuration will not be persisted. \"\n                \"Please use environment variables via api_key_env_var for persistent storage.\",\n                DeprecationWarning,\n            )\n        if os.getenv(\"HUGGINGFACE_API_KEY\") is not None:\n            self.api_key_env_var = \"HUGGINGFACE_API_KEY\"\n        else:\n            self.api_key_env_var = api_key_env_var\n\n        self.api_key = api_key or os.getenv(self.api_key_env_var)\n        if not self.api_key:\n            raise ValueError(\n                f\"The {self.api_key_env_var} environment variable is not set.\"\n            )\n\n        self.model_name = model_name\n\n        self._api_url = f\"https://api-inference.huggingface.co/pipeline/feature-extraction/{model_name}\"\n        self._session = httpx.Client()\n        self._session.headers.update({\"Authorization\": f\"Bearer {self.api_key}\"})\n\n    def __call__(self, input: Documents) -> Embeddings:\n        \"\"\"\n        Get the embeddings for a list of texts.\n\n        Args:\n            input (Documents): A list of texts to get embeddings for.\n\n        Returns:\n            Embeddings: The embeddings for the texts.","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/huggingface_embedding_function.py#L32-L68","documentation":"Error \"The {self.api_key_env_var} environment variable is not set.\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/utils/embedding_functions/huggingface_embedding_function.py:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}