{"record":{"id":"359f75d87cbc5eb3","repo":"vitessio/vitess","slug":"gettabletmapforshard-s-s-failed-w","errorCode":null,"errorMessage":"GetTabletMapForShard(%s, %s) failed: %w","messagePattern":"GetTabletMapForShard\\((.+?), (.+?)\\) failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/server.go","lineNumber":2332,"sourceCode":"\tctx, cancel := context.WithTimeout(ctx, topo.RemoteOperationTimeout)\n\tdefer cancel()\n\n\tvar tabletMap map[string]*topo.TabletInfo\n\n\tswitch {\n\tcase len(req.TabletAliases) > 0:\n\t\tspan.Annotate(\"tablet_aliases\", strings.Join(topoproto.TabletAliasList(req.TabletAliases).ToStringSlice(), \",\"))\n\n\t\ttabletMap, err = s.ts.GetTabletMap(ctx, req.TabletAliases, nil)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"GetTabletMap(%v) failed: %w\", req.TabletAliases, err)\n\t\t}\n\tcase req.Keyspace != \"\" && req.Shard != \"\":\n\t\tspan.Annotate(\"shard\", req.Shard)\n\n\t\ttabletMap, err = s.ts.GetTabletMapForShard(ctx, req.Keyspace, req.Shard)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"GetTabletMapForShard(%s, %s) failed: %w\", req.Keyspace, req.Shard, err)\n\t\t}\n\tdefault:\n\t\t// goto the req.Cells branch\n\t\ttabletMap = nil\n\t}\n\n\tif err != nil {\n\t\tswitch {\n\t\tcase topo.IsErrType(err, topo.PartialResult):\n\t\t\tif req.Strict {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tlog.Warn(fmt.Sprintf(\"GetTablets encountered non-fatal error %s; continuing because Strict=false\", err))\n\t\tdefault:\n\t\t\treturn nil, err\n\t\t}\n\t}\n","sourceCodeStart":2314,"sourceCodeEnd":2350,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/server.go#L2314-L2350","documentation":"Returned by the grpcvtctldserver when fetching the tablet map for a shard from the topology fails, wrapping the topo error with the keyspace and shard being queried.","triggerScenarios":"Calling GetTablets with req.Keyspace and req.Shard set when the shard record is missing, unreadable, or the topo store call fails.","commonSituations":"Typo in keyspace/shard name, shard not yet created in the topo, or topo store outage during scripted operations.","solutions":["Verify the keyspace and shard names are correct and the shard record exists in the topo.","Check topo server health and connectivity from vtctld.","Retry after transient topo failures."],"exampleFix":"// before\nvtctldclient GetTablets --keyspace commerce --shard \"0-\"\n// after\nvtctldclient GetTablets --keyspace commerce --shard \"-\"","handlingStrategy":"validation","validationCode":"if _, err := s.ts.GetShard(ctx, req.Keyspace, req.Shard); err != nil {\n    return fmt.Errorf(\"shard %s/%s not found: %w\", req.Keyspace, req.Shard, err)\n}","typeGuard":null,"tryCatchPattern":"tabletMap, err := s.ts.GetTabletMapForShard(ctx, req.Keyspace, req.Shard)\nif err != nil {\n    return fmt.Errorf(\"GetTabletMapForShard(%s, %s) failed: %w\", req.Keyspace, req.Shard, err)\n}","preventionTips":["Validate keyspace/shard names against the topo before calling","Retry on transient topo errors","Use GetShard first to confirm the shard record exists"],"tags":["vitess","topo","grpc","shard"],"backgroundTag":"topo-lookup-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}