vitessio/vitess · error

FindAllTabletAliasesInShard(%v, %v) failed: %v

Error message

FindAllTabletAliasesInShard(%v, %v) failed: %v

What it means

Returned by ValidateSchemaShard when listing all tablet aliases in the shard via the topo (wr.ts.FindAllTabletAliasesInShard) fails. This step enumerates every tablet in the shard so their schemas can be diffed against the primary's.

Source

Thrown at go/vt/wrangler/schema.go:86

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

	// read all the aliases in the shard, that is all tablets that are
	// replicating from the primary
	aliases, err := wr.ts.FindAllTabletAliasesInShard(ctx, keyspace, shard)
	if err != nil {
		return fmt.Errorf("FindAllTabletAliasesInShard(%v, %v) failed: %v", keyspace, shard, err)
	}

	// then diff with all replicas
	er := concurrency.AllErrorRecorder{}
	wg := sync.WaitGroup{}
	for _, alias := range aliases {
		if topoproto.TabletAliasEqual(alias, si.PrimaryAlias) {
			continue
		}

		wg.Add(1)
		go wr.diffSchema(ctx, primarySchema, si.PrimaryAlias, alias, excludeTables, includeViews, &wg, &er)
	}
	wg.Wait()
	if er.HasErrors() {
		return fmt.Errorf("schema diffs: %v", er.Error().Error())
	}
	return nil

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Check topo server availability and vtctld topo flags
  2. Retry the command — topo blips are often transient
  3. Confirm the shard still exists in the topo (vtctldclient GetShard)
  4. Inspect the wrapped topo error for connection/refused or permission details
Defensive patterns

Strategy: retry

Validate before calling

aliases, err := ts.FindAllTabletAliasesInShard(ctx, keyspace, shard)
if err != nil { return fmt.Errorf("precheck topo read failed: %w", err) }
if len(aliases) == 0 { return fmt.Errorf("no tablets found in shard") }

Type guard

func shardHasTablets(ctx context.Context, ts topoclient.Server, keyspace, shard string) bool {
    a, err := ts.FindAllTabletAliasesInShard(ctx, keyspace, shard)
    return err == nil && len(a) > 0
}

Try / catch

err := wr.ValidateSchemaShard(ctx, ks, shard, nil, true, false)
if err != nil && strings.Contains(err.Error(), "FindAllTabletAliasesInShard") {
    // topo transient error; back off and retry
}

Prevention

When it happens

Trigger: ValidateSchemaShard invocation where the topo call to list shard tablet aliases errors: topo server unavailable, shard record missing, or topo read timeout.

Common situations: etcd/zookeeper/consul outage; wrong topo configuration on vtctld; shard deleted between GetShard and this call; transient topo latency.

Related errors


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