{"record":{"id":"d7b0eda66396f0b4","repo":"vitessio/vitess","slug":"w-no-cluster-with-id-s","errorCode":null,"errorMessage":"%w: no cluster with id %s","messagePattern":"%w: no cluster with id (.+?)","errorType":"error_code","errorClass":"errors.ErrUnsupportedCluster","httpStatus":null,"severity":"error","filePath":"go/vt/vtadmin/api.go","lineNumber":2876,"sourceCode":"\tif !api.authz.IsAuthorized(ctx, req.ClusterId, rbac.WorkflowResource, rbac.CreateAction) {\n\t\treturn nil, fmt.Errorf(\"%w: cannot switch traffic for workflow in %s\", errors.ErrUnauthorized, req.ClusterId)\n\t}\n\n\tc, err := api.getClusterForRequest(req.ClusterId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.Vtctld.WorkflowSwitchTraffic(ctx, req.Request)\n}\n\nfunc (api *API) getClusterForRequest(id string) (*cluster.Cluster, error) {\n\tapi.clusterMu.Lock()\n\tdefer api.clusterMu.Unlock()\n\n\tc, ok := api.clusterMap[id]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"%w: no cluster with id %s\", errors.ErrUnsupportedCluster, id)\n\t}\n\n\treturn c, nil\n}\n\nfunc (api *API) getClustersForRequest(ids []string) ([]*cluster.Cluster, []string) {\n\tapi.clusterMu.Lock()\n\tdefer api.clusterMu.Unlock()\n\n\tif len(ids) == 0 {\n\t\tclusterIDs := make([]string, 0, len(api.clusters))\n\n\t\tfor k := range api.clusterMap {\n\t\t\tclusterIDs = append(clusterIDs, k)\n\t\t}\n\n\t\treturn api.clusters, clusterIDs\n\t}","sourceCodeStart":2858,"sourceCodeEnd":2894,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtadmin/api.go#L2858-L2894","documentation":"Returned by API.getClusterForRequest when the supplied cluster id is not present in vtadmin's in-memory clusterMap. The error wraps errors.ErrUnsupportedCluster so callers can detect it via errors.Is. It means vtadmin was not configured to serve this cluster, not that the cluster is down.","triggerScenarios":"Any API method that calls getClusterForRequest (e.g. WorkflowSwitchTraffic) with a req.ClusterId that does not match a cluster id in the vtadmin config (or an id whose cluster failed to load at startup).","commonSituations":"Typo in cluster id in client request or dashboard; vtadmin started with a config file that omits the cluster; cluster id renamed in config while clients cache the old id.","solutions":["Verify req.ClusterId matches a cluster id listed in the vtadmin startup config (--config clusters)","Call the GetClusters endpoint to list the valid cluster ids","Correct the cluster id in the calling tool/dashboard config and retry"],"exampleFix":"// before\nreq := &vtadminpb.SwitchTabsRequest{ClusterId: \"prodcuster\"}\n// after\nreq := &vtadminpb.SwitchTabsRequest{ClusterId: \"prodcluster\"}","handlingStrategy":"validation","validationCode":"clusters, err := client.GetClusters(ctx, &vtadminpb.GetClustersRequest{})\nif err != nil { return err }\nvalid := map[string]bool{}\nfor _, c := range clusters.Clusters { valid[c.Id] = true }\nif !valid[req.ClusterId] {\n    return fmt.Errorf(\"cluster id %q is not configured in vtadmin\", req.ClusterId)\n}","typeGuard":null,"tryCatchPattern":"c, err := client.GetWorkflow(ctx, req)\nif err != nil {\n    if errors.Is(err, vtadminerrors.ErrUnsupportedCluster) {\n        // refresh cluster list / fix cluster id\n        return fmt.Errorf(\"unknown cluster %q; valid ids: %v\", req.ClusterId, listClusterIDs(ctx, client))\n    }\n    return err\n}","preventionTips":["Source cluster ids dynamically from GetClusters instead of hardcoding","Keep client configs in sync with vtadmin's cluster config file","Alert on cluster ids that vanish from vtadmin config after deploys"],"tags":["vtadmin","configuration","cluster-id"],"backgroundTag":"unknown-cluster-id","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}