weaviate/weaviate · error

failed to get tenants: %w

Error message

failed to get tenants: %w

What it means

Wraps an error from schemaReader.GetConsistentTenants when the MCP get-tenants tool lists tenants of a collection. The cause is in the wrapped error: nonexistent collection, tenant store failure, or authorization denial — not a tenant-listing problem per se.

Source

Thrown at adapters/handlers/mcp/read/tenants.go:44

		"tool":       "weaviate-tenants-list",
		"collection": args.CollectionName,
	})
	log.Debug("listing tenants")

	// Tool-level authz only. GetConsistentTenants resolves the class name and
	// applies per-tenant RBAC via its ShardsMetadata filter, so an additional
	// CollectionsData pre-check here would both double-resolve the name and
	// gate on the wrong permission (read_data vs. read_tenants).
	principal, err := r.Authorize(ctx, req, authorization.READ)
	if err != nil {
		return nil, err
	}
	defer func() { retErr = namespacing.StripErrForPrincipal(principal, retErr) }()

	tenants, err := r.schemaReader.GetConsistentTenants(ctx, principal, args.CollectionName, true, nil)
	if err != nil {
		log.Warnf("failed to get tenants: %v", err)
		return nil, fmt.Errorf("failed to get tenants: %w", err)
	}
	return &GetTenantsResp{Tenants: tenants}, nil
}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Verify the collection exists (list collections) before fetching tenants
  2. Inspect the wrapped error for the storage/permission root cause
  3. Ensure the caller has RBAC permission to read tenants on that collection
  4. Retry once cluster health is restored if the cause was transient

Example fix

// before
tenants, err := r.schemaReader.GetConsistentTenants(ctx, principal, args.CollectionName, true, nil)
// "failed to get tenants: ... such class ..."
// after: confirm collection exists first, then call GetTenants with the exact name
Defensive patterns

Strategy: validation

Validate before calling

// Go: confirm the collection exists (and is multi-tenant) before listing tenants
_, err := tool.GetCollectionConfig(ctx, GetCollectionConfigArgs{CollectionName: coll})
if err != nil {
	return fmt.Errorf("cannot list tenants; collection missing or unreadable: %v", err)
}

Try / catch

tenants, err := tool.GetTenants(ctx, args)
if err != nil && strings.Contains(err.Error(), "failed to get tenants") {
	log.Warnf("tenant fetch failed: %v", errors.Unwrap(err))
	// retry after cluster health check or fix permission/collection name
}

Prevention

When it happens

Trigger: Calling GetTenants with args.CollectionName that does not exist, when the tenant store cannot be read (node/raft issues), or when RBAC denies tenant reads on that collection.

Common situations: Typo'd or deleted collection name; requesting tenants of a non-multi-tenant collection path incorrectly; caller lacking list-tenants permission; cluster instability during reads.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/c07b926b2ca2f01c. Report an issue: GitHub.