{"record":{"id":"58070bb5bf2adaa0","repo":"vitessio/vitess","slug":"getshard-s-failed-v","errorCode":null,"errorMessage":"GetShard(%s) failed: %v","messagePattern":"GetShard\\((.+?)\\) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/server.go","lineNumber":5408,"sourceCode":"\t\tresp.Results = append(resp.Results, shardResp.Results...)\n\t\tresp.ResultsByShard[shard] = &shardResp\n\t\tvalidateVersionKeyspaceResponseMutex.Unlock()\n\t}\n\n\treturn resp, err\n}\n\n// ValidateVersionShard validates all versions are the same in all\n// tablets in a shard\nfunc (s *VtctldServer) ValidateVersionShard(ctx context.Context, req *vtctldatapb.ValidateVersionShardRequest) (resp *vtctldatapb.ValidateVersionShardResponse, err error) {\n\tspan, ctx := trace.NewSpan(ctx, \"VtctldServer.ValidateVersionShard\")\n\tdefer span.Finish()\n\n\tdefer panicHandler(&err)\n\n\tshard, err := s.ts.GetShard(ctx, req.Keyspace, req.Shard)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"GetShard(%s) failed: %v\", req.Shard, err)\n\t\treturn nil, err\n\t}\n\n\tif !shard.HasPrimary() {\n\t\terr = fmt.Errorf(\"no primary in shard %v/%v\", req.Keyspace, req.Shard)\n\t\treturn nil, err\n\t}\n\n\tlog.Info(fmt.Sprintf(\"Gathering version for primary %v\", topoproto.TabletAliasString(shard.PrimaryAlias)))\n\tprimaryVersion, err := s.GetVersion(ctx, &vtctldatapb.GetVersionRequest{\n\t\tTabletAlias: shard.PrimaryAlias,\n\t})\n\tif err != nil {\n\t\terr = fmt.Errorf(\"GetVersion(%s) failed: %v\", topoproto.TabletAliasString(shard.PrimaryAlias), err)\n\t\treturn nil, err\n\t}\n\n\taliases, err := s.ts.FindAllTabletAliasesInShard(ctx, req.Keyspace, req.Shard)","sourceCodeStart":5390,"sourceCodeEnd":5426,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/server.go#L5390-L5426","documentation":"ValidateShard (and similar shard-level RPCs) first loads the shard record from the topo with ts.GetShard. If the shard record cannot be read, the error is wrapped as \"GetShard(%s) failed: %v\" and returned to the caller.","triggerScenarios":"Calling ValidateShard with a keyspace/shard whose record is missing or unreadable in the topology server.","commonSituations":"Typo in shard name (e.g. \"-80\" vs \"0\"); shard already deleted; topo backend (etcd/zk) outage or misconfigured topo flags.","solutions":["List actual shards with vtctldclient GetShards <keyspace> and correct the shard name.","Check topo server connectivity/config (topo flags, etcd/zk health).","If the shard record is corrupt, repair it via topo tooling before retrying."],"exampleFix":"// before\nvtctldclient ValidateShard commerce \"-\"\n// after (correct shard name)\nvtctldclient ValidateShard commerce \"0\"","handlingStrategy":"validation","validationCode":"shards, err := ts.GetShardNames(ctx, keyspace); if err != nil { return err }; if !slices.Contains(shards, shardName) { return fmt.Errorf(\"shard %s/%s does not exist\", keyspace, shardName) }","typeGuard":null,"tryCatchPattern":"shard, err := ts.GetShard(ctx, ks, shard); if err != nil { if topo.IsErrType(err, topo.NoNode) { return fmt.Errorf(\"shard %s/%s not found in topo\", ks, shard) }; return err }","preventionTips":["List shards with GetShards before shard-scoped commands","Use tabular shard-name output verbatim (leading '-' included)","Check topo backend health when many shard ops fail at once"],"tags":["topo","shard","vtctld"],"backgroundTag":"shard-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}