{"record":{"id":"a13f9388243a1105","repo":"vitessio/vitess","slug":"getschema-v-nil-v-v-failed-v-a13f93","errorCode":null,"errorMessage":"GetSchema(%v, nil, %v, %v) failed: %v","messagePattern":"GetSchema\\((.+?), nil, (.+?), (.+?)\\) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/schema.go","lineNumber":49,"sourceCode":"\t\"vitess.io/vitess/go/vt/schema\"\n\t\"vitess.io/vitess/go/vt/topo\"\n\t\"vitess.io/vitess/go/vt/topo/topoproto\"\n\t\"vitess.io/vitess/go/vt/vtctl/schematools\"\n\t\"vitess.io/vitess/go/vt/vttablet/tabletmanager/vreplication\"\n\n\ttabletmanagerdatapb \"vitess.io/vitess/go/vt/proto/tabletmanagerdata\"\n\ttopodatapb \"vitess.io/vitess/go/vt/proto/topodata\"\n\tvtctldatapb \"vitess.io/vitess/go/vt/proto/vtctldata\"\n)\n\n// helper method to asynchronously diff a schema\nfunc (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}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/schema.go#L31-L67","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the tablet is healthy (vtctldclient GetTablets; check vttablet logs) and restart it if down","Re-run the validate command once the tablet is back in service","Verify network connectivity from vtctld to the failing tablet's grpc port","If a specific tablet is persistently broken, remove/replace it before validating"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check tablet health before validating\nfor _, alias := range aliases {\n    ti, err := ts.GetTablet(ctx, alias)\n    if err != nil || ti.Type == topodatapb.TabletType_UNKNOWN { return fmt.Errorf(\"tablet %s unhealthy\", topoproto.TabletAliasString(alias)) }\n}","typeGuard":"func tabletReachable(ctx context.Context, tmc tabletmanagerclient.TabletManagerClient, alias *topodatapb.TabletAlias) bool {\n    _, err := tmc.Ping(ctx, alias)\n    return err == nil\n}","tryCatchPattern":"err := wr.ValidateSchemaShard(ctx, keyspace, shard, nil, true, false)\nif err != nil && strings.Contains(err.Error(), \"GetSchema\") {\n    log.Warn(\"tablet unreachable during schema validation; retry after checking tablet health\", slog.Any(\"error\", err))\n}","preventionTips":["Verify all tablets in the shard are serving before validation","Monitor tablet grpc connectivity","Retry validation after transient tablet restarts"],"tags":["vitess","schema-validation","tablet-rpc"],"backgroundTag":"get-schema-rpc-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}