{"record":{"id":"3b11de17afdf6a66","repo":"chroma-core/chroma","slug":"could-not-connect-to-tenant-tenant-are-you-sure-3b11de","errorCode":null,"errorMessage":"Could not connect to tenant {tenant}. Are you sure it exists?","messagePattern":"Could not connect to tenant (.+?)\\. Are you sure it exists\\?","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/api/client.py","lineNumber":794,"sourceCode":"        exc_type: Optional[type[BaseException]],\n        exc_val: Optional[BaseException],\n        exc_tb: Optional[TracebackType],\n    ) -> None:\n        \"\"\"Context manager exit.\"\"\"\n        self.close()\n\n    def _validate_tenant_database(self, tenant: str, database: str) -> None:\n        try:\n            self._admin_client.get_tenant(name=tenant)\n        except httpx.ConnectError:\n            raise ValueError(\n                \"Could not connect to a Chroma server. Are you sure it is running?\"\n            )\n        # Propagate ChromaErrors\n        except ChromaError as e:\n            raise e\n        except Exception:\n            raise ValueError(\n                f\"Could not connect to tenant {tenant}. Are you sure it exists?\"\n            )\n\n        try:\n            self._admin_client.get_database(name=database, tenant=tenant)\n        except httpx.ConnectError:\n            raise ValueError(\n                \"Could not connect to a Chroma server. Are you sure it is running?\"\n            )\n\n    # endregion\n\n\nclass AdminClient(SharedSystemClient, AdminAPI):\n    \"\"\"Admin client for managing tenants and databases.\"\"\"\n\n    _server: ServerAPI\n","sourceCodeStart":776,"sourceCodeEnd":812,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/client.py#L776-L812","documentation":"Catch-all in the sync client's _validate_tenant_database(): get_tenant() raised something that is neither httpx.ConnectError nor a ChromaError. A truly missing tenant surfaces as a structured ChromaError (NotFoundError) that the preceding branch re-raises untouched, so this 'Are you sure it exists?' ValueError actually hides an unexpected non-Chroma failure — most often the bare Exception(resp.text) that _raise_chroma_error raises for proxy/gateway responses.","triggerScenarios":"Reverse proxy in front of Chroma answering get_tenant with 502/504 HTML; gateway rate-limit responses; an auth provider bug raising a plain exception; incompatible server versions emitting unrecognized error bodies.","commonSituations":"Load balancer returning errors during Chroma restarts; infra sidecars rewriting responses; version skew between client and server.","solutions":["Unwrap the cause: except ValueError as e: inspect e.__cause__ — it holds the real exception and response body.","Bypass the proxy and call the server directly to isolate the layer at fault.","Align chromadb versions on client and server.","Fix proxy timeout/error configuration so Chroma's JSON errors pass through."],"exampleFix":"# before\nexcept ValueError as e:\n    raise RuntimeError(f\"tenant broken: {e}\")  # masks real cause\n\n# after\nexcept ValueError as e:\n    raise RuntimeError(f\"tenant validation failed: {e!r}, cause={e.__cause__!r}\")","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from chromadb.errors import ChromaError\n\ntry:\n    client.set_tenant(\"acme\")\nexcept ValueError as e:\n    cause = e.__cause__\n    if isinstance(cause, ChromaError):\n        raise cause  # authoritative server error\n    raise RuntimeError(f\"unexpected failure validating tenant: {cause!r}\") from e","preventionTips":["Log the chained cause, not the wrapper message.","Validate the network path and proxy layer when this appears without server-side errors.","Keep client/server versions in lockstep."],"tags":["chroma","tenant","error-mapping","proxy","sync"],"backgroundTag":"unexpected-server-response","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}