{"record":{"id":"9d16747790361d84","repo":"vitessio/vitess","slug":"getschema-s-nil-v-v-v-v-failed-v","errorCode":null,"errorMessage":"GetSchema(%s, nil, %v, %v) (%v/%v) failed: %v","messagePattern":"GetSchema\\((.+?), nil, (.+?), (.+?)\\) \\((.+?)/(.+?)\\) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/schema.go","lineNumber":151,"sourceCode":"\t}\n\n\tshardFailures := concurrency.AllErrorRecorder{}\n\tvar wg sync.WaitGroup\n\twg.Add(len(shards))\n\n\tfor _, shard := range shards {\n\t\tgo func(shard string) {\n\t\t\tdefer wg.Done()\n\t\t\tnotFoundTables := []string{}\n\t\t\tsi, err := wr.ts.GetShard(ctx, keyspace, shard)\n\t\t\tif err != nil {\n\t\t\t\tshardFailures.RecordError(fmt.Errorf(\"GetShard(%v, %v) failed: %v\", keyspace, shard, err))\n\t\t\t\treturn\n\t\t\t}\n\t\t\treq := &tabletmanagerdatapb.GetSchemaRequest{ExcludeTables: excludeTables, IncludeViews: includeViews}\n\t\t\tprimarySchema, err := schematools.GetSchema(ctx, wr.ts, wr.tmc, si.PrimaryAlias, req)\n\t\t\tif err != nil {\n\t\t\t\tshardFailures.RecordError(fmt.Errorf(\"GetSchema(%s, nil, %v, %v) (%v/%v) failed: %v\", si.PrimaryAlias.String(),\n\t\t\t\t\texcludeTables, includeViews, keyspace, shard, err,\n\t\t\t\t))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, tableDef := range primarySchema.TableDefinitions {\n\t\t\t\tif _, ok := vschm.Tables[tableDef.Name]; !ok {\n\t\t\t\t\tif !schema.IsInternalOperationTableName(tableDef.Name) {\n\t\t\t\t\t\tnotFoundTables = append(notFoundTables, tableDef.Name)\n\t\t\t\t\t}\n\t\t\t\t}\n\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()","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/schema.go#L133-L169","documentation":"Inside ValidateVSchema, after fetching the shard record, the wrangler calls schematools.GetSchema on the shard's primary tablet to retrieve its table definitions. This error is recorded when that RPC fails — the primary tablet was unreachable, not serving, or failed to return its schema. The failure is aggregated in shardFailures and surfaced by ValidateVSchema.","triggerScenarios":"Calling ValidateVSchema when a shard's primary tablet is down, the tabletmanager RPC GetSchema times out or errors, or si.PrimaryAlias points to a non-existent/failed tablet.","commonSituations":"Primary tablet crashed or was restarted during validation; vttablet process not running; firewall/network partition between vtctld and the tablet; tablet in a non-serving state (e.g. during reparent).","solutions":["Check tablet health: vtctl GetAllTablets <keyspace> and verify the primary tablet is serving.","Restart or repair the failing vttablet process.","Confirm network connectivity between vtctld and the tablet's gRPC port.","Re-run ValidateVSchema once the primary is healthy; check the wrapped inner error for the specific RPC cause."],"exampleFix":"// before (primary down)\nwr.ValidateVSchema(ctx, \"commerce\", []string{\"0\"}, nil, nil, true)\n// after\n// start/restart vttablet on the primary, verify with vtctl GetTablet <alias>, then retry\nwr.ValidateVSchema(ctx, \"commerce\", []string{\"0\"}, nil, nil, true)","handlingStrategy":"try-catch","validationCode":"for _, shard := range shards {\n\tsi, err := ts.GetShard(ctx, ks, shard)\n\tif err == nil && si.PrimaryAlias != nil {\n\t\t_, err = tmc.GetSchema(ctx, si.PrimaryAlias, &tabletmanagerdatapb.GetSchemaRequest{})\n\t}\n\tif err != nil { return fmt.Errorf(\"shard %s/%s unhealthy: %w\", ks, shard, err) }\n}","typeGuard":null,"tryCatchPattern":"if err := wr.ValidateVSchema(ctx, ks, shards, nil, nil, true); err != nil {\n\tlog.Error(err, \"per-shard GetSchema failure; check tablet health for each shard primary\")\n}","preventionTips":["Run vtctl HealthCheck / tablet health monitoring before schema operations","Avoid running validation during reparents or tablet restarts","Verify primary aliases are set on all shards before validating"],"tags":["tablet","rpc","schema","validation"],"backgroundTag":"tablet-rpc-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}