vitessio/vitess · error

GetShard(%s) failed: %v

Error message

GetShard(%s) failed: %v

What it means

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.

Source

Thrown at go/vt/vtctl/grpcvtctldserver/server.go:5408

		resp.Results = append(resp.Results, shardResp.Results...)
		resp.ResultsByShard[shard] = &shardResp
		validateVersionKeyspaceResponseMutex.Unlock()
	}

	return resp, err
}

// ValidateVersionShard validates all versions are the same in all
// tablets in a shard
func (s *VtctldServer) ValidateVersionShard(ctx context.Context, req *vtctldatapb.ValidateVersionShardRequest) (resp *vtctldatapb.ValidateVersionShardResponse, err error) {
	span, ctx := trace.NewSpan(ctx, "VtctldServer.ValidateVersionShard")
	defer span.Finish()

	defer panicHandler(&err)

	shard, err := s.ts.GetShard(ctx, req.Keyspace, req.Shard)
	if err != nil {
		err = fmt.Errorf("GetShard(%s) failed: %v", req.Shard, err)
		return nil, err
	}

	if !shard.HasPrimary() {
		err = fmt.Errorf("no primary in shard %v/%v", req.Keyspace, req.Shard)
		return nil, err
	}

	log.Info(fmt.Sprintf("Gathering version for primary %v", topoproto.TabletAliasString(shard.PrimaryAlias)))
	primaryVersion, err := s.GetVersion(ctx, &vtctldatapb.GetVersionRequest{
		TabletAlias: shard.PrimaryAlias,
	})
	if err != nil {
		err = fmt.Errorf("GetVersion(%s) failed: %v", topoproto.TabletAliasString(shard.PrimaryAlias), err)
		return nil, err
	}

	aliases, err := s.ts.FindAllTabletAliasesInShard(ctx, req.Keyspace, req.Shard)

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. List actual shards with vtctldclient GetShards <keyspace> and correct the shard name.
  2. Check topo server connectivity/config (topo flags, etcd/zk health).
  3. If the shard record is corrupt, repair it via topo tooling before retrying.

Example fix

// before
vtctldclient ValidateShard commerce "-"
// after (correct shard name)
vtctldclient ValidateShard commerce "0"
Defensive patterns

Strategy: validation

Validate before calling

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) }

Try / catch

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 }

Prevention

When it happens

Trigger: Calling ValidateShard with a keyspace/shard whose record is missing or unreadable in the topology server.

Common situations: Typo in shard name (e.g. "-80" vs "0"); shard already deleted; topo backend (etcd/zk) outage or misconfigured topo flags.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/58070bb5bf2adaa0. Report an issue: GitHub.