{"record":{"id":"d5d725c7b00eb62c","repo":"vitessio/vitess","slug":"getshard-v-v-failed-v","errorCode":null,"errorMessage":"GetShard(%v, %v) failed: %v","messagePattern":"GetShard\\((.+?), (.+?)\\) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/schema.go","lineNumber":61,"sourceCode":"func (wr *Wrangler) diffSchema(ctx context.Context, primarySchema *tabletmanagerdatapb.SchemaDefinition, primaryTabletAlias, alias *topodatapb.TabletAlias, excludeTables []string, includeViews bool, wg *sync.WaitGroup, er concurrency.ErrorRecorder) {\n\tdefer wg.Done()\n\tlog.Info(fmt.Sprintf(\"Gathering schema for %v\", topoproto.TabletAliasString(alias)))\n\treq := &tabletmanagerdatapb.GetSchemaRequest{ExcludeTables: excludeTables, IncludeViews: includeViews}\n\treplicaSchema, err := schematools.GetSchema(ctx, wr.ts, wr.tmc, alias, req)\n\tif err != nil {\n\t\ter.RecordError(fmt.Errorf(\"GetSchema(%v, nil, %v, %v) failed: %v\", alias, excludeTables, includeViews, err))\n\t\treturn\n\t}\n\n\tlog.Info(fmt.Sprintf(\"Diffing schema for %v\", topoproto.TabletAliasString(alias)))\n\ttmutils.DiffSchema(topoproto.TabletAliasString(primaryTabletAlias), primarySchema, topoproto.TabletAliasString(alias), replicaSchema, er)\n}\n\n// ValidateSchemaShard will diff the schema from all the tablets in the shard.\nfunc (wr *Wrangler) ValidateSchemaShard(ctx context.Context, keyspace, shard string, excludeTables []string, includeViews bool, includeVSchema bool) error {\n\tsi, err := wr.ts.GetShard(ctx, keyspace, shard)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetShard(%v, %v) failed: %v\", keyspace, shard, err)\n\t}\n\n\t// get schema from the primary, or error\n\tif !si.HasPrimary() {\n\t\treturn fmt.Errorf(\"no primary in shard %v/%v\", keyspace, shard)\n\t}\n\tlog.Info(fmt.Sprintf(\"Gathering schema for primary %v\", topoproto.TabletAliasString(si.PrimaryAlias)))\n\treq := &tabletmanagerdatapb.GetSchemaRequest{ExcludeTables: excludeTables, IncludeViews: includeViews}\n\tprimarySchema, err := schematools.GetSchema(ctx, wr.ts, wr.tmc, si.PrimaryAlias, req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetSchema(%v, nil, %v, %v) failed: %v\", si.PrimaryAlias, excludeTables, includeViews, err)\n\t}\n\n\tif includeVSchema {\n\t\terr := wr.ValidateVSchema(ctx, keyspace, []string{shard}, excludeTables, includeViews)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/schema.go#L43-L79","documentation":"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.","triggerScenarios":"vtctldclient ValidateSchemaShard <keyspace/shard> when the topo server is unreachable, or the shard record does not exist (typo in keyspace/shard name).","commonSituations":"Topo (etcd/zk/consul) outage or misconfigured topo flags; shard was never created or was deleted; keyspace/shard name misspelled in the command.","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"],"exampleFix":"// before\nvtctldclient ValidateSchemaShard commerce/0 # if shard doesn't exist\n// after: confirm shard exists first\nvtctldclient FindAllShardsInKeyspace commerce\nvtctldclient ValidateSchemaShard commerce/0","handlingStrategy":"validation","validationCode":"_, err := ts.GetShard(ctx, keyspace, shard)\nif err != nil {\n    return fmt.Errorf(\"shard %s/%s not usable for validation: %w\", keyspace, shard, err)\n}","typeGuard":"func shardExists(ctx context.Context, ts topoclient.Server, keyspace, shard string) bool {\n    _, err := ts.GetShard(ctx, keyspace, shard)\n    return err == nil\n}","tryCatchPattern":"if err := wr.ValidateSchemaShard(ctx, ks, shard, nil, true, false); err != nil {\n    if strings.Contains(err.Error(), \"GetShard\") {\n        // topo/keyspace-shard problem; check topo health and names\n    }\n}","preventionTips":["Confirm shard names with FindAllShardsInKeyspace before validating","Monitor topo server availability","Avoid validating shards during topology maintenance"],"tags":["vitess","topo","schema-validation"],"backgroundTag":"topo-shard-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}