vitessio/vitess · error

GetTablet(%v) failed: %v

Error message

GetTablet(%v) failed: %v

What it means

PreflightSchema resolves the target tablet alias to a full tablet record via wr.ts.GetTablet before sending the schema preflight request. This error is returned when the alias cannot be resolved — the tablet is not registered in the topology, or the topo lookup failed. It wraps the underlying topo error.

Source

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

			}
			if len(notFoundTables) > 0 {
				shardFailure := fmt.Errorf("%v/%v has tables that are not in the vschema: %v", keyspace, shard, notFoundTables)
				shardFailures.RecordError(shardFailure)
			}
		}(shard)
	}
	wg.Wait()
	if shardFailures.HasErrors() {
		return fmt.Errorf("ValidateVSchema(%v, %v, %v, %v) failed: %v", keyspace, shards, excludeTables, includeViews, shardFailures.Error().Error())
	}
	return nil
}

// PreflightSchema will try a schema change on the remote tablet.
func (wr *Wrangler) PreflightSchema(ctx context.Context, tabletAlias *topodatapb.TabletAlias, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) {
	ti, err := wr.ts.GetTablet(ctx, tabletAlias)
	if err != nil {
		return nil, fmt.Errorf("GetTablet(%v) failed: %v", tabletAlias, err)
	}
	return wr.tmc.PreflightSchema(ctx, ti.Tablet, changes)
}

// CopySchemaShardFromShard copies the schema from a source shard to the specified destination shard.
// For both source and destination it picks the primary tablet. See also CopySchemaShard.
func (wr *Wrangler) CopySchemaShardFromShard(ctx context.Context, tables, excludeTables []string, includeViews bool, sourceKeyspace, sourceShard, destKeyspace, destShard string, waitReplicasTimeout time.Duration, skipVerify bool) error {
	sourceShardInfo, err := wr.ts.GetShard(ctx, sourceKeyspace, sourceShard)
	if err != nil {
		return fmt.Errorf("GetShard(%v, %v) failed: %v", sourceKeyspace, sourceShard, err)
	}
	if sourceShardInfo.PrimaryAlias == nil {
		return fmt.Errorf("no primary in shard record %v/%v. Consider running 'vtctl InitShardPrimary' in case of a new shard or reparenting the shard to fix the topology data, or providing a non-primary tablet alias", sourceKeyspace, sourceShard)
	}

	return wr.CopySchemaShard(ctx, sourceShardInfo.PrimaryAlias, tables, excludeTables, includeViews, destKeyspace, destShard, waitReplicasTimeout, skipVerify)
}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Run vtctl GetTablet <alias> to verify the alias resolves; correct any typo in cell/uid.
  2. List current tablets with vtctl ListAllTablets / GetAllTablets and use a valid alias.
  3. Check topo server connectivity if the wrapped error indicates a connection problem.
  4. Retry after the tablet registers (e.g. right after vttablet startup, wait for it to appear in topo).

Example fix

// before
wr.PreflightSchema(ctx, aliasFromStaleConfig, []string{"ALTER TABLE users ADD COLUMN c int"})
// after: resolve a live alias first
tablets, _ := wr.ts.GetTabletsByCell(ctx, "cell1")
wr.PreflightSchema(ctx, tablets[0].Alias, []string{"ALTER TABLE users ADD COLUMN c int"})
Defensive patterns

Strategy: validation

Validate before calling

func aliasExists(ctx context.Context, ts topoc.Server, alias *topodatapb.TabletAlias) error {
	_, err := ts.GetTablet(ctx, alias)
	return err
}
if err := aliasExists(ctx, ts, tabletAlias); err != nil { return err }

Try / catch

results, err := wr.PreflightSchema(ctx, tabletAlias, changes)
if err != nil {
	if strings.Contains(err.Error(), "GetTablet") {
		// alias unresolvable; list tablets and pick a valid one
	}
	return err
}

Prevention

When it happens

Trigger: Calling PreflightSchema (vtctl PreflightSchema) with a tablet alias that doesn't exist in the topo server, is malformed, or when the topo server is unreachable.

Common situations: Typo in the alias (e.g. wrong cell or uid); tablet was decommissioned; topo connectivity outage; using an alias captured before a tablet was re-initialized with a new uid.

Related errors


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