chroma-core/chroma · error · ValueError

Could not connect to tenant {tenant}. Are you sure it exists

Error message

Could not connect to tenant {tenant}. Are you sure it exists?

What it means

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.

Source

Thrown at chromadb/api/client.py:794

        exc_type: Optional[type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> None:
        """Context manager exit."""
        self.close()

    def _validate_tenant_database(self, tenant: str, database: str) -> None:
        try:
            self._admin_client.get_tenant(name=tenant)
        except httpx.ConnectError:
            raise ValueError(
                "Could not connect to a Chroma server. Are you sure it is running?"
            )
        # Propagate ChromaErrors
        except ChromaError as e:
            raise e
        except Exception:
            raise ValueError(
                f"Could not connect to tenant {tenant}. Are you sure it exists?"
            )

        try:
            self._admin_client.get_database(name=database, tenant=tenant)
        except httpx.ConnectError:
            raise ValueError(
                "Could not connect to a Chroma server. Are you sure it is running?"
            )

    # endregion


class AdminClient(SharedSystemClient, AdminAPI):
    """Admin client for managing tenants and databases."""

    _server: ServerAPI

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Unwrap the cause: except ValueError as e: inspect e.__cause__ — it holds the real exception and response body.
  2. Bypass the proxy and call the server directly to isolate the layer at fault.
  3. Align chromadb versions on client and server.
  4. Fix proxy timeout/error configuration so Chroma's JSON errors pass through.

Example fix

# before
except ValueError as e:
    raise RuntimeError(f"tenant broken: {e}")  # masks real cause

# after
except ValueError as e:
    raise RuntimeError(f"tenant validation failed: {e!r}, cause={e.__cause__!r}")
Defensive patterns

Strategy: try-catch

Try / catch

from chromadb.errors import ChromaError

try:
    client.set_tenant("acme")
except ValueError as e:
    cause = e.__cause__
    if isinstance(cause, ChromaError):
        raise cause  # authoritative server error
    raise RuntimeError(f"unexpected failure validating tenant: {cause!r}") from e

Prevention

When it happens

Trigger: 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.

Common situations: Load balancer returning errors during Chroma restarts; infra sidecars rewriting responses; version skew between client and server.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/3b11de17afdf6a66. Report an issue: GitHub.