vitessio/vitess · error

GetSchema(%v, nil, %v, %v) failed: %v

Error message

GetSchema(%v, nil, %v, %v) failed: %v

What it means

Recorded by wrangler.diffSchema when fetching the replica/tablet schema via schematools.GetSchema fails while diffing a non-primary tablet against the primary during schema validation. The error includes the tablet alias, excludeTables, includeViews parameters and the underlying cause. It is recorded on the ErrorRecorder rather than returned, then aggregated into 'schema diffs'.

Source

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

	"vitess.io/vitess/go/vt/schema"
	"vitess.io/vitess/go/vt/topo"
	"vitess.io/vitess/go/vt/topo/topoproto"
	"vitess.io/vitess/go/vt/vtctl/schematools"
	"vitess.io/vitess/go/vt/vttablet/tabletmanager/vreplication"

	tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata"
	topodatapb "vitess.io/vitess/go/vt/proto/topodata"
	vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
)

// helper method to asynchronously diff a schema
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)
	}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Check the tablet is healthy (vtctldclient GetTablets; check vttablet logs) and restart it if down
  2. Re-run the validate command once the tablet is back in service
  3. Verify network connectivity from vtctld to the failing tablet's grpc port
  4. If a specific tablet is persistently broken, remove/replace it before validating
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check tablet health before validating
for _, alias := range aliases {
    ti, err := ts.GetTablet(ctx, alias)
    if err != nil || ti.Type == topodatapb.TabletType_UNKNOWN { return fmt.Errorf("tablet %s unhealthy", topoproto.TabletAliasString(alias)) }
}

Type guard

func tabletReachable(ctx context.Context, tmc tabletmanagerclient.TabletManagerClient, alias *topodatapb.TabletAlias) bool {
    _, err := tmc.Ping(ctx, alias)
    return err == nil
}

Try / catch

err := wr.ValidateSchemaShard(ctx, keyspace, shard, nil, true, false)
if err != nil && strings.Contains(err.Error(), "GetSchema") {
    log.Warn("tablet unreachable during schema validation; retry after checking tablet health", slog.Any("error", err))
}

Prevention

When it happens

Trigger: Running ValidateSchemaShard or ValidateSchemaKeyspace when GetSchema RPC to a tablet (vttablet) fails: tablet down, RPC timeout, tablet serving type mismatch, or tablet manager error reading the schema.

Common situations: Replica tablet is offline or restarting during validation; network partition between vtctld and the tablet; tablet not started; permissions or mysqld issues preventing schema read.

Related errors


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