chroma-core/chroma · error
Could not connect to tenant ${tenant}. Are you sure it exist
Error message
Could not connect to tenant ${tenant}. Are you sure it exists? Underlying error:
${error} What it means
validateTenantDatabase() calls AdminClient.getTenant({ name: tenant }); if it throws anything that is NOT a ChromaConnectionError, the error is wrapped with this message. Because connection-level failures are rethrown untouched, seeing this message means the server WAS reached and answered — almost always that the tenant does not exist (404) on that server.
Source
Thrown at clients/js/packages/chromadb-core/src/utils.ts:69
* @param {string} moduleName - Specifies the module to import.
* @returns {Promise<any>} Returns a Promise that resolves to the imported module.
*/
export async function importOptionalModule(moduleName: string) {
return Function(`return import("${moduleName}")`)();
}
export async function validateTenantDatabase(
adminClient: AdminClient,
tenant: string,
database: string,
): Promise<void> {
try {
await adminClient.getTenant({ name: tenant });
} catch (error) {
if (error instanceof ChromaConnectionError) {
throw error;
}
throw new Error(
`Could not connect to tenant ${tenant}. Are you sure it exists? Underlying error:
${error}`,
);
}
try {
await adminClient.getDatabase({ name: database, tenantName: tenant });
} catch (error) {
if (error instanceof ChromaConnectionError) {
throw error;
}
throw new Error(
`Could not connect to database ${database} for tenant ${tenant}. Are you sure it exists? Underlying error:
${error}`,
);
}
}
View on GitHub (pinned to aecdd12c8a)
Solutions
- Create the tenant first: await adminClient.createTenant({ name: tenant }) — creating an existing tenant is not an error, so this is safe to run idempotently.
- List tenants to verify the exact name: (await adminClient.listTenants()).forEach(t => console.log(t.name)).
- Confirm the client points at the server where the tenant was created (path/host/port, auth provider).
- Check for typos, case sensitivity, and trailing whitespace in the tenant string.
Example fix
// before
const client = new ChromaClient({ tenant: "acme", database: "prod-db" });
await client.listCollections(); // init() -> getTenant 404 -> throws
// after
const admin = new AdminClient({ path: "http://localhost:8000" });
await admin.createTenant({ name: "acme" });
await admin.createDatabase({ name: "prod-db", tenantName: "acme" });
const client = new ChromaClient({ tenant: "acme", database: "prod-db" }); Defensive patterns
Strategy: validation
Validate before calling
// Ensure the tenant exists before pointing a client at it
const ensureTenant = async (admin: AdminClient, tenant: string) => {
try {
await admin.getTenant({ name: tenant });
} catch (e) {
if (e instanceof ChromaConnectionError) throw e; // server unreachable — different problem
await admin.createTenant({ name: tenant }); // 404 -> create idempotently
}
};
await ensureTenant(admin, "acme"); Try / catch
try {
await client.listCollections(); // triggers init()/tenant validation
} catch (e) {
const msg = e instanceof Error ? e.message : String(e);
if (msg.startsWith("Could not connect to tenant")) {
throw new Error(`Tenant not found — run adminClient.createTenant({ name: tenant }) first`, { cause: e });
}
throw e;
} Prevention
- Make tenant creation part of deployment scripts (createTenant is idempotent) before any ChromaClient uses the tenant.
- Keep server host/port in one shared config so dev/prod never point at different Chroma instances with divergent tenants.
- Validate tenant names at config load time (typos, case, whitespace) before constructing clients.
When it happens
Trigger: new ChromaClient({ tenant: 'acme', database: 'db' }) (validated on first init()/operation), adminClient.setTenant({ tenant: 'acme', database: 'db' }), or adminClient.setDatabase() where tenant 'acme' was never created with adminClient.createTenant({ name: 'acme' }) — or exists on a different server (wrong host/port).
Common situations: First use of multi-tenant mode assuming tenants auto-create; typo/case difference in the tenant name; connecting to default localhost:8000 in prod while the tenant lives on another instance; load-balanced Chroma instances with divergent state.
Related errors
- Could not connect to database ${database} for tenant ${tenan
- Your API key does not have access to any DBs for tenant ${th
- The requested resource could not be found
- Could not connect to a Chroma server. Are you sure it is run
- Could not connect to tenant {tenant}. Are you sure it exists
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/c365cab1b032f741.
Report an issue: GitHub.