{"record":{"id":"406ff3463efb48c5","repo":"vitessio/vitess","slug":"gettablet-v-failed-v","errorCode":null,"errorMessage":"GetTablet(%v) failed: %v","messagePattern":"GetTablet\\((.+?)\\) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/schema.go","lineNumber":180,"sourceCode":"\t\t\t}\n\t\t\tif len(notFoundTables) > 0 {\n\t\t\t\tshardFailure := fmt.Errorf(\"%v/%v has tables that are not in the vschema: %v\", keyspace, shard, notFoundTables)\n\t\t\t\tshardFailures.RecordError(shardFailure)\n\t\t\t}\n\t\t}(shard)\n\t}\n\twg.Wait()\n\tif shardFailures.HasErrors() {\n\t\treturn fmt.Errorf(\"ValidateVSchema(%v, %v, %v, %v) failed: %v\", keyspace, shards, excludeTables, includeViews, shardFailures.Error().Error())\n\t}\n\treturn nil\n}\n\n// PreflightSchema will try a schema change on the remote tablet.\nfunc (wr *Wrangler) PreflightSchema(ctx context.Context, tabletAlias *topodatapb.TabletAlias, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) {\n\tti, err := wr.ts.GetTablet(ctx, tabletAlias)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GetTablet(%v) failed: %v\", tabletAlias, err)\n\t}\n\treturn wr.tmc.PreflightSchema(ctx, ti.Tablet, changes)\n}\n\n// CopySchemaShardFromShard copies the schema from a source shard to the specified destination shard.\n// For both source and destination it picks the primary tablet. See also CopySchemaShard.\nfunc (wr *Wrangler) CopySchemaShardFromShard(ctx context.Context, tables, excludeTables []string, includeViews bool, sourceKeyspace, sourceShard, destKeyspace, destShard string, waitReplicasTimeout time.Duration, skipVerify bool) error {\n\tsourceShardInfo, err := wr.ts.GetShard(ctx, sourceKeyspace, sourceShard)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetShard(%v, %v) failed: %v\", sourceKeyspace, sourceShard, err)\n\t}\n\tif sourceShardInfo.PrimaryAlias == nil {\n\t\treturn 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)\n\t}\n\n\treturn wr.CopySchemaShard(ctx, sourceShardInfo.PrimaryAlias, tables, excludeTables, includeViews, destKeyspace, destShard, waitReplicasTimeout, skipVerify)\n}\n","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/schema.go#L162-L198","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run vtctl GetTablet <alias> to verify the alias resolves; correct any typo in cell/uid.","List current tablets with vtctl ListAllTablets / GetAllTablets and use a valid alias.","Check topo server connectivity if the wrapped error indicates a connection problem.","Retry after the tablet registers (e.g. right after vttablet startup, wait for it to appear in topo)."],"exampleFix":"// before\nwr.PreflightSchema(ctx, aliasFromStaleConfig, []string{\"ALTER TABLE users ADD COLUMN c int\"})\n// after: resolve a live alias first\ntablets, _ := wr.ts.GetTabletsByCell(ctx, \"cell1\")\nwr.PreflightSchema(ctx, tablets[0].Alias, []string{\"ALTER TABLE users ADD COLUMN c int\"})","handlingStrategy":"validation","validationCode":"func aliasExists(ctx context.Context, ts topoc.Server, alias *topodatapb.TabletAlias) error {\n\t_, err := ts.GetTablet(ctx, alias)\n\treturn err\n}\nif err := aliasExists(ctx, ts, tabletAlias); err != nil { return err }","typeGuard":null,"tryCatchPattern":"results, err := wr.PreflightSchema(ctx, tabletAlias, changes)\nif err != nil {\n\tif strings.Contains(err.Error(), \"GetTablet\") {\n\t\t// alias unresolvable; list tablets and pick a valid one\n\t}\n\treturn err\n}","preventionTips":["Resolve aliases dynamically via ts.GetTabletsByCell rather than hardcoding","Re-read aliases after tablet re-initialization (uids change)","Add topo connectivity checks to operational runbooks"],"tags":["topology","tablet-alias","preflight","topo-lookup"],"backgroundTag":"topo-tablet-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}