{"record":{"id":"c07b926b2ca2f01c","repo":"weaviate/weaviate","slug":"failed-to-get-tenants-w","errorCode":null,"errorMessage":"failed to get tenants: %w","messagePattern":"failed to get tenants: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/handlers/mcp/read/tenants.go","lineNumber":44,"sourceCode":"\t\t\"tool\":       \"weaviate-tenants-list\",\n\t\t\"collection\": args.CollectionName,\n\t})\n\tlog.Debug(\"listing tenants\")\n\n\t// Tool-level authz only. GetConsistentTenants resolves the class name and\n\t// applies per-tenant RBAC via its ShardsMetadata filter, so an additional\n\t// CollectionsData pre-check here would both double-resolve the name and\n\t// gate on the wrong permission (read_data vs. read_tenants).\n\tprincipal, err := r.Authorize(ctx, req, authorization.READ)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() { retErr = namespacing.StripErrForPrincipal(principal, retErr) }()\n\n\ttenants, err := r.schemaReader.GetConsistentTenants(ctx, principal, args.CollectionName, true, nil)\n\tif err != nil {\n\t\tlog.Warnf(\"failed to get tenants: %v\", err)\n\t\treturn nil, fmt.Errorf(\"failed to get tenants: %w\", err)\n\t}\n\treturn &GetTenantsResp{Tenants: tenants}, nil\n}\n","sourceCodeStart":26,"sourceCodeEnd":48,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/mcp/read/tenants.go#L26-L48","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the collection exists (list collections) before fetching tenants","Inspect the wrapped error for the storage/permission root cause","Ensure the caller has RBAC permission to read tenants on that collection","Retry once cluster health is restored if the cause was transient"],"exampleFix":"// before\ntenants, err := r.schemaReader.GetConsistentTenants(ctx, principal, args.CollectionName, true, nil)\n// \"failed to get tenants: ... such class ...\"\n// after: confirm collection exists first, then call GetTenants with the exact name","handlingStrategy":"validation","validationCode":"// Go: confirm the collection exists (and is multi-tenant) before listing tenants\n_, err := tool.GetCollectionConfig(ctx, GetCollectionConfigArgs{CollectionName: coll})\nif err != nil {\n\treturn fmt.Errorf(\"cannot list tenants; collection missing or unreadable: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"tenants, err := tool.GetTenants(ctx, args)\nif err != nil && strings.Contains(err.Error(), \"failed to get tenants\") {\n\tlog.Warnf(\"tenant fetch failed: %v\", errors.Unwrap(err))\n\t// retry after cluster health check or fix permission/collection name\n}","preventionTips":["Validate collection name against the schema before tenant calls","Grant the MCP principal read-tenants permission","Only list tenants for collections configured with multi-tenancy enabled"],"tags":["mcp","tenants","multi-tenancy","error-wrapping"],"backgroundTag":"tenant-fetch-failed","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}