vitessio/vitess · error
GetShard(%v, %v) failed: %v
Error message
GetShard(%v, %v) failed: %v
What it means
Returned by ValidateSchemaShard when the topo lookup for the shard record (wr.ts.GetShard) fails. Without the shard record the validator cannot find the primary alias to use as the schema baseline. The keyspace, shard, and underlying topo error are embedded in the message.
Source
Thrown at go/vt/wrangler/schema.go:61
func (wr *Wrangler) diffSchema(ctx context.Context, primarySchema *tabletmanagerdatapb.SchemaDefinition, primaryTabletAlias, alias *topodatapb.TabletAlias, excludeTables []string, includeViews bool, wg *sync.WaitGroup, er concurrency.ErrorRecorder) {
defer wg.Done()
log.Info(fmt.Sprintf("Gathering schema for %v", topoproto.TabletAliasString(alias)))
req := &tabletmanagerdatapb.GetSchemaRequest{ExcludeTables: excludeTables, IncludeViews: includeViews}
replicaSchema, err := schematools.GetSchema(ctx, wr.ts, wr.tmc, alias, req)
if err != nil {
er.RecordError(fmt.Errorf("GetSchema(%v, nil, %v, %v) failed: %v", alias, excludeTables, includeViews, err))
return
}
log.Info(fmt.Sprintf("Diffing schema for %v", topoproto.TabletAliasString(alias)))
tmutils.DiffSchema(topoproto.TabletAliasString(primaryTabletAlias), primarySchema, topoproto.TabletAliasString(alias), replicaSchema, er)
}
// ValidateSchemaShard will diff the schema from all the tablets in the shard.
func (wr *Wrangler) ValidateSchemaShard(ctx context.Context, keyspace, shard string, excludeTables []string, includeViews bool, includeVSchema bool) error {
si, err := wr.ts.GetShard(ctx, keyspace, shard)
if err != nil {
return fmt.Errorf("GetShard(%v, %v) failed: %v", keyspace, shard, err)
}
// get schema from the primary, or error
if !si.HasPrimary() {
return fmt.Errorf("no primary in shard %v/%v", keyspace, shard)
}
log.Info(fmt.Sprintf("Gathering schema for primary %v", topoproto.TabletAliasString(si.PrimaryAlias)))
req := &tabletmanagerdatapb.GetSchemaRequest{ExcludeTables: excludeTables, IncludeViews: includeViews}
primarySchema, err := schematools.GetSchema(ctx, wr.ts, wr.tmc, si.PrimaryAlias, req)
if err != nil {
return fmt.Errorf("GetSchema(%v, nil, %v, %v) failed: %v", si.PrimaryAlias, excludeTables, includeViews, err)
}
if includeVSchema {
err := wr.ValidateVSchema(ctx, keyspace, []string{shard}, excludeTables, includeViews)
if err != nil {
return err
}View on GitHub (pinned to 01a25a7d17)
Solutions
- Verify the keyspace/shard names are correct (vtctldclient GetTablets or FindAllShardsInKeyspace)
- Check topo server health and vtctld topo flags (etcd/zk servers reachable)
- If the shard record is missing, the shard was deleted or never created — recreate it or validate a different shard
- Inspect the wrapped topo error for auth/quota/permission problems
Example fix
// before vtctldclient ValidateSchemaShard commerce/0 # if shard doesn't exist // after: confirm shard exists first vtctldclient FindAllShardsInKeyspace commerce vtctldclient ValidateSchemaShard commerce/0
Defensive patterns
Strategy: validation
Validate before calling
_, err := ts.GetShard(ctx, keyspace, shard)
if err != nil {
return fmt.Errorf("shard %s/%s not usable for validation: %w", keyspace, shard, err)
} Type guard
func shardExists(ctx context.Context, ts topoclient.Server, keyspace, shard string) bool {
_, err := ts.GetShard(ctx, keyspace, shard)
return err == nil
} Try / catch
if err := wr.ValidateSchemaShard(ctx, ks, shard, nil, true, false); err != nil {
if strings.Contains(err.Error(), "GetShard") {
// topo/keyspace-shard problem; check topo health and names
}
} Prevention
- Confirm shard names with FindAllShardsInKeyspace before validating
- Monitor topo server availability
- Avoid validating shards during topology maintenance
When it happens
Trigger: vtctldclient ValidateSchemaShard <keyspace/shard> when the topo server is unreachable, or the shard record does not exist (typo in keyspace/shard name).
Common situations: Topo (etcd/zk/consul) outage or misconfigured topo flags; shard was never created or was deleted; keyspace/shard name misspelled in the command.
Related errors
- FindAllTabletAliasesInShard(%v, %v) failed: %v
- GetVSchema(%s) failed: %v
- GetTabletMap(%v) failed: %w
- GetTabletMapForShard(%s, %s) failed: %w
- GetTabletsByCell(%s) failed: %w
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/d5d725c7b00eb62c.
Report an issue: GitHub.