{"record":{"id":"df6f210c4b7b6945","repo":"vitessio/vitess","slug":"w-s","errorCode":null,"errorMessage":"%w: %s","messagePattern":"%w: %s","errorType":"validation","errorClass":"ErrUnsupportedCluster","httpStatus":null,"severity":"error","filePath":"go/vt/vtadmin/api.go","lineNumber":1625,"sourceCode":"}\n\n// GetVSchemas is part of the vtadminpb.VTAdminServer interface.\nfunc (api *API) GetVSchemas(ctx context.Context, req *vtadminpb.GetVSchemasRequest) (*vtadminpb.GetVSchemasResponse, error) {\n\tspan, ctx := trace.NewSpan(ctx, \"API.GetVSchemas\")\n\tdefer span.Finish()\n\n\tclusters, _ := api.getClustersForRequest(req.ClusterIds)\n\n\tvar (\n\t\tm        sync.Mutex\n\t\twg       sync.WaitGroup\n\t\trec      concurrency.AllErrorRecorder\n\t\tvschemas []*vtadminpb.VSchema\n\t)\n\n\tif len(clusters) == 0 {\n\t\tif len(req.ClusterIds) > 0 {\n\t\t\treturn nil, fmt.Errorf(\"%w: %s\", errors.ErrUnsupportedCluster, strings.Join(req.ClusterIds, \", \"))\n\t\t}\n\n\t\treturn &vtadminpb.GetVSchemasResponse{VSchemas: []*vtadminpb.VSchema{}}, nil\n\t}\n\n\tfor _, c := range clusters {\n\t\tif !api.authz.IsAuthorized(ctx, c.ID, rbac.VSchemaResource, rbac.GetAction) {\n\t\t\tcontinue\n\t\t}\n\n\t\twg.Add(1)\n\n\t\tgo func(c *cluster.Cluster) {\n\t\t\tdefer wg.Done()\n\n\t\t\tspan, ctx := trace.NewSpan(ctx, \"Cluster.GetVSchemas\")\n\t\t\tdefer span.Finish()\n","sourceCodeStart":1607,"sourceCodeEnd":1643,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtadmin/api.go#L1607-L1643","documentation":"API.GetVSchemas resolves the requested clusters first; if no clusters match — meaning the caller explicitly passed ClusterIds that do not correspond to any configured cluster — it returns errors.ErrUnsupportedCluster wrapped with the requested IDs via %w. It is a sentinel-wrapped error so callers can errors.Is against ErrUnsupportedCluster.","triggerScenarios":"Calling GetVSchemas with req.ClusterIds containing IDs that are not configured in vtadmin (typo, renamed cluster, cluster removed from config), resulting in len(clusters)==0 with non-empty ClusterIds.","commonSituations":"Cluster renamed or decommissioned in vtadmin config while dashboards/scripts still use the old ID; case-sensitivity mismatch in cluster IDs; stale cached cluster list in a client.","solutions":["Check the returned message for the offending cluster IDs and compare against vtadmin's configured clusters (vtadmin config / --clusters flag)","Correct the cluster ID in the request or add the missing cluster to vtadmin's configuration","Handle errors.ErrUnsupportedCluster with errors.Is in clients to distinguish config drift from transient failures","Refresh the client's cluster list from the vtadmin GetClusters API"],"exampleFix":"// before: request with stale ID\nreq := &vtadminpb.GetVSchemasRequest{ClusterIds: []string{\"old-cluster\"}}\n// after: fetch current IDs first and validate\nclusters, _ := client.GetClusters(ctx, &vtadminpb.GetClustersRequest{})\nids := clusterIDs(clusters) // ensure \"old-cluster\" is present before calling GetVSchemas","handlingStrategy":"validation","validationCode":"// Go: validate cluster IDs before calling GetVSchemas\nclusters, _ := client.GetClusters(ctx, &vtadminpb.GetClustersRequest{})\nknown := map[string]bool{}\nfor _, c := range clusters.Clusters {\n\tknown[c.Id] = true\n}\nfor _, id := range req.ClusterIds {\n\tif !known[id] {\n\t\treturn fmt.Errorf(\"unknown cluster id %q\", id)\n\t}\n}","typeGuard":"func isUnsupportedCluster(err error) bool {\n\treturn errors.Is(err, vtadminerrors.ErrUnsupportedCluster)\n}","tryCatchPattern":"resp, err := client.GetVSchemas(ctx, req)\nif err != nil {\n\tif isUnsupportedCluster(err) {\n\t\t// refresh cluster list / fix IDs\n\t}\n\treturn err\n}","preventionTips":["Fetch the live cluster list before sending cluster-scoped requests","Use errors.Is against ErrUnsupportedCluster in clients","Keep cluster IDs in a single source of truth","Handle cluster renames/removals in automation"],"tags":["vtadmin","cluster-id","unsupported-cluster","validation"],"backgroundTag":"unsupported-cluster","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}