{"record":{"id":"89ef26af0c5b7616","repo":"vitessio/vitess","slug":"failed-to-get-shard-s-s-w","errorCode":null,"errorMessage":"failed to get shard %s/%s/: %w","messagePattern":"failed to get shard (.+?)/(.+?)/: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/server.go","lineNumber":3445,"sourceCode":"\n\tdefer panicHandler(&err)\n\n\tif req.Keyspace == \"\" {\n\t\terr = vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, \"RefreshStateByShard requires a keyspace\")\n\t\treturn nil, err\n\t}\n\n\tif req.Shard == \"\" {\n\t\terr = vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, \"RefreshStateByShard requires a shard\")\n\t\treturn nil, err\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, topo.RemoteOperationTimeout)\n\tdefer cancel()\n\n\tsi, err := s.ts.GetShard(ctx, req.Keyspace, req.Shard)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to get shard %s/%s/: %w\", req.Keyspace, req.Shard, err)\n\t\treturn nil, err\n\t}\n\n\tisPartial, partialDetails, err := topotools.RefreshTabletsByShard(ctx, s.ts, s.tmc, si, req.Cells, logutil.NewCallbackLogger(func(e *logutilpb.Event) {\n\t\tswitch e.Level {\n\t\tcase logutilpb.Level_WARNING:\n\t\t\tlog.Warn(e.Value)\n\t\tcase logutilpb.Level_ERROR:\n\t\t\tlog.Error(e.Value)\n\t\tdefault:\n\t\t\tlog.Info(e.Value)\n\t\t}\n\t}))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &vtctldatapb.RefreshStateByShardResponse{","sourceCodeStart":3427,"sourceCodeEnd":3463,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/server.go#L3427-L3463","documentation":"During RefreshTablets (shard-level tablet refresh), the shard record itself could not be fetched from the topology. The keyspace/shard lookup error is wrapped and returned, aborting the refresh of all tablets in that shard.","triggerScenarios":"RefreshTablets RPC (e.g. from vtctldclient RefreshTablets or RemoveKeyspaceCell flows) where topo.GetShard fails because the shard doesn't exist, keyspace is mistyped, or the topo server is unreachable.","commonSituations":"Keyspace/shard already deleted by concurrent operation; typo in keyspace or shard name; etcd/zk outage or ACL denying read.","solutions":["Verify the shard exists: `vtctldclient GetShard <keyspace> <shard>`","Correct keyspace/shard spelling in the command or script","Check topo server connectivity and permissions","If the shard was intentionally deleted, skip the refresh for it"],"exampleFix":"// before\nvtctldclient RefreshTablets commerce/0 typo\n// after\nvtctldclient GetShard commerce 0\nvtctldclient RefreshTablets commerce/0","handlingStrategy":"validation","validationCode":"// verify the shard exists before refreshing tablets\nif _, err := vtctld.GetShard(ctx, keyspace, shard); err != nil {\n    return fmt.Errorf(\"shard %s/%s does not exist: %w\", keyspace, shard, err)\n}","typeGuard":null,"tryCatchPattern":"// distinguish topo-not-found from transient topo errors\nif errors.Is(err, topo.ErrNodeNotFound) {\n    return nil // shard gone; nothing to refresh\n}\nreturn retryRefreshTablets(ctx, req)","preventionTips":["Validate keyspace/shard names in scripts against a live listing","Check topo server health before bulk refresh operations","Guard against concurrent keyspace deletions in automation","Use canonical shard naming (e.g. '-' ranges) to avoid typos"],"tags":["vtctld","topology","shard-lookup"],"backgroundTag":"shard-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}