vitessio/vitess · error

GetVSchemas(cluster = %s): %w

Error message

GetVSchemas(cluster = %s): %w

What it means

After a cluster finishes fetching all its per-keyspace vschemas, any previously recorded per-keyspace errors are collapsed into a single cluster-level error with this wrapper ("GetVSchemas(cluster = <ID>): <aggregated>") and recorded on the outer recorder, so one bad keyspace fails the whole cluster and the overall GetVSchemas RPC.

Source

Thrown at go/vt/vtadmin/api.go:1685

				go func(keyspace *vtctldatapb.Keyspace) {
					defer clusterWG.Done()
					vschema, err := c.GetVSchema(ctx, keyspace.Name)
					if err != nil {
						clusterRec.RecordError(fmt.Errorf("GetVSchema(keyspace = %s): %w", keyspace.Name, err))
						return
					}

					clusterM.Lock()
					clusterVSchemas = append(clusterVSchemas, vschema)
					clusterM.Unlock()
				}(keyspace)
			}

			clusterWG.Wait()

			if clusterRec.HasErrors() {
				rec.RecordError(fmt.Errorf("GetVSchemas(cluster = %s): %w", c.ID, clusterRec.Error()))
				return
			}

			m.Lock()
			vschemas = append(vschemas, clusterVSchemas...)
			m.Unlock()
		}(c)
	}

	wg.Wait()

	if rec.HasErrors() {
		return nil, rec.Error()
	}

	return &vtadminpb.GetVSchemasResponse{
		VSchemas: vschemas,
	}, nil

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Inspect the aggregated inner errors to find which keyspaces failed
  2. Fix the failing keyspaces' vschemas in the topo (validate JSON, re-apply)
  3. Verify topo server health and retry the request
  4. Handle errors.ErrUnsupportedCluster separately if the cluster ID itself was wrong

Example fix

// before
if clusterRec.HasErrors() {
	rec.RecordError(fmt.Errorf("GetVSchemas(cluster = %s): %w", c.ID, clusterRec.Error()))
	return
}
// after: repair failing keyspaces' vschemas first, then the cluster aggregates cleanly
if clusterRec.HasErrors() {
	rec.RecordError(fmt.Errorf("GetVSchemas(cluster = %s): %w", c.ID, clusterRec.Error()))
	return
}
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure all keyspaces in the cluster have readable vschemas first
keyspaces, _ := vtctldClient.GetKeyspaces(ctx, &vtctldatapb.GetKeyspacesRequest{})
for _, ks := range keyspaces.Keyspaces {
	if _, err := vtctldClient.GetVSchema(ctx, &vtctldatapb.GetVSchemaRequest{Keyspace: ks.Name}); err != nil {
		log.Printf("keyspace %s has bad vschema: %v", ks.Name, err)
	}
}

Type guard

func clusterVSchemaFailed(msg string) bool { return strings.Contains(msg, "GetVSchemas(cluster = ") }

Try / catch

resp, err := client.GetVSchemas(ctx, req)
if err != nil {
	if strings.Contains(err.Error(), "GetVSchemas(cluster = ") {
		// drill into aggregated per-keyspace causes in the message
	}
	return err
}

Prevention

When it happens

Trigger: Calling GetVSchemas when any c.GetVSchema call within the cluster failed (see error 795) — the aggregated clusterRec.Error() is wrapped here with the cluster ID.

Common situations: One or more keyspace vschemas invalid or unreadable; topo instability during the fan-out; keyspace deleted mid-request.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/5e5b3761996188d3. Report an issue: GitHub.