{"record":{"id":"40f117cfe772a11b","repo":"vitessio/vitess","slug":"getvschema-s-failed-v-40f117","errorCode":null,"errorMessage":"GetVSchema(%s) failed: %v","messagePattern":"GetVSchema\\((.+?)\\) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/schema.go","lineNumber":132,"sourceCode":"\t\tSkipNoPrimary:  skipNoPrimary,\n\t})\n\n\tfor _, result := range res.Results {\n\t\twr.Logger().Printf(\"%s\\n\", result)\n\t}\n\n\tif len(res.Results) > 0 {\n\t\treturn fmt.Errorf(\"schema diffs: %v\", res.Results)\n\t}\n\n\treturn err\n}\n\n// ValidateVSchema compares the schema of each primary tablet in \"keyspace/shards...\" to the vschema and errs if there are differences\nfunc (wr *Wrangler) ValidateVSchema(ctx context.Context, keyspace string, shards []string, excludeTables []string, includeViews bool) error {\n\tvschm, err := wr.ts.GetVSchema(ctx, keyspace)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetVSchema(%s) failed: %v\", keyspace, err)\n\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 {","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/schema.go#L114-L150","documentation":"Returned by ValidateVSchema when reading the keyspace's vschema from the topo (wr.ts.GetVSchema) fails. The validation compares each primary tablet's schema against the vschema, so it cannot proceed without the vschema record. Keyspace name and cause are embedded.","triggerScenarios":"ValidateVSchema or ValidateSchemaShard/ValidateSchemaKeyspace with includeVSchema=true, when the topo GetVSchema call errors: topo unavailable, keyspace record missing, or corrupted/unparsable vschema stored in the topo.","commonSituations":"Topo server outage; keyspace never had a vschema created; vschema JSON corrupted by a bad ApplyVSchema; typo in keyspace name.","solutions":["Check the keyspace name is correct and the vschema exists (vtctldclient GetVSchema <keyspace>)","Verify topo server health and connectivity from vtctld","If the vschema is missing/corrupt, re-apply a valid one (vtctldclient ApplyVSchema --vschema ...)","Retry after transient topo issues are resolved"],"exampleFix":"// before: vschema missing for keyspace\n// after: create it\nvtctldclient ApplyVSchema --vschema '{\"sharded\": true, \"vindexes\": {...}}' commerce","handlingStrategy":"validation","validationCode":"vs, err := ts.GetVSchema(ctx, keyspace)\nif err != nil { return fmt.Errorf(\"cannot validate vschema: %w\", err) }\nif vs == nil || len(vs.GetTables()) == 0 { return fmt.Errorf(\"keyspace %s has no usable vschema\", keyspace) }","typeGuard":"func vschemaReadable(ctx context.Context, ts topoclient.Server, keyspace string) bool {\n    vs, err := ts.GetVSchema(ctx, keyspace)\n    return err == nil && vs != nil\n}","tryCatchPattern":"err := wr.ValidateVSchema(ctx, ks, shards, nil, true)\nif err != nil && strings.Contains(err.Error(), \"GetVSchema\") {\n    // check topo health / re-apply vschema, then retry\n}","preventionTips":["Apply a vschema when the keyspace is created, before any validation","Validate vschema JSON with ApplyVSchema dry-run semantics before storing","Monitor topo availability for the keyspace records"],"tags":["vitess","vschema","topo","schema-validation"],"backgroundTag":"get-vschema-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}