{"record":{"id":"84c4658065e0b0ae","repo":"chroma-core/chroma","slug":"could-not-determine-a-database-name-from-the-curre","errorCode":null,"errorMessage":"Could not determine a database name from the current authentication method. Please provide a database name.","messagePattern":"Could not determine a database name from the current authentication method\\. Please provide a database name\\.","errorType":"exception","errorClass":"ChromaAuthError","httpStatus":null,"severity":"error","filePath":"chromadb/api/client.py","lineNumber":103,"sourceCode":"            # Get the root system component we want to interact with\n            self._server = self._system.instance(ServerAPI)\n\n            user_identity = self.get_user_identity()\n\n            maybe_tenant, maybe_database = maybe_set_tenant_and_database(\n                user_identity,\n                overwrite_singleton_tenant_database_access_from_auth=settings.chroma_overwrite_singleton_tenant_database_access_from_auth,\n                user_provided_tenant=tenant,\n                user_provided_database=database,\n            )\n\n            # this should not happen unless types are invalidated\n            if maybe_tenant is None and tenant is None:\n                raise ChromaAuthError(\n                    \"Could not determine a tenant from the current authentication method. Please provide a tenant.\"\n                )\n            if maybe_database is None and database is None:\n                raise ChromaAuthError(\n                    \"Could not determine a database name from the current authentication method. Please provide a database name.\"\n                )\n\n            if maybe_tenant:\n                self.tenant = maybe_tenant\n            if maybe_database:\n                self.database = maybe_database\n\n            # Create an admin client for verifying that databases and tenants exist\n            self._admin_client = AdminClient.from_system(self._system)\n            self._validate_tenant_database(tenant=self.tenant, database=self.database)\n\n            self._submit_client_start_event()\n        except Exception:\n            # If init fails after refcount was incremented, release references\n            # to avoid a resource leak (the caller never receives the object to\n            # call close() on it).\n            if hasattr(self, \"_admin_client\"):","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/api/client.py#L85-L121","documentation":"Companion to the tenant check in Client.__init__: after resolving the user identity, maybe_set_tenant_and_database() also derives a database name from the auth method. If the identity provides none and no database= argument was given, construction fails with ChromaAuthError. It indicates the token/credentials carry no database information.","triggerScenarios":"Token auth where the JWT includes a tenant claim but no database claim and Client() is created without database=; an auth provider returning an identity that names a tenant but not a database.","commonSituations":"Partially-configured RBAC tokens; auth provider upgrades that stopped embedding database info; apps that previously relied on the default database but enabled strict auth resolution.","solutions":["Pass the database explicitly: Client(tenant=\"acme\", database=\"my_db\").","Re-issue credentials/tokens that include the database claim.","Verify the auth provider settings and chroma_overwrite_singleton_tenant_database_access_from_auth configuration."],"exampleFix":"# before\nclient = chromadb.HttpClient(settings=auth_settings, tenant=\"acme\")  # no db claim -> ChromaAuthError\n\n# after\nclient = chromadb.HttpClient(settings=auth_settings, tenant=\"acme\", database=\"prod\")","handlingStrategy":"validation","validationCode":"import base64, json\n\ndef jwt_claims(token: str) -> dict:\n    payload = token.split(\".\")[1]\n    return json.loads(base64.urlsafe_b64decode(payload + \"=\" * (-len(payload) % 4)))\n\nclaims = jwt_claims(os.environ[\"CHROMA_TOKEN\"])\nkwargs = {}\nif \"tenant\" not in claims:\n    kwargs[\"tenant\"] = \"acme\"\nif \"database\" not in claims:\n    kwargs[\"database\"] = \"prod\"\nclient = chromadb.HttpClient(settings=auth_settings, **kwargs)","typeGuard":null,"tryCatchPattern":"from chromadb.errors import ChromaAuthError\n\ntry:\n    client = chromadb.HttpClient(settings=auth_settings, tenant=\"acme\")\nexcept ChromaAuthError as e:\n    if \"database name\" in str(e):\n        client = chromadb.HttpClient(settings=auth_settings, tenant=\"acme\", database=\"prod\")\n    else:\n        raise","preventionTips":["Pass database= explicitly whenever tokens don't guarantee it.","Encode tenant and database in every token your auth provider issues.","Centralize client construction in one helper that always sets both."],"tags":["chroma","authentication","database","rbac","client-init"],"backgroundTag":"authentication-configuration","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}