vitessio/vitess · error

GetSrvVSchema(%s): %w

Error message

GetSrvVSchema(%s): %w

What it means

VTEXplain also fetches the per-cell SrvVSchema (the routing rules/vschema deployed to a cell) from vtctld. If the GetSrvVSchema RPC fails, the error is recorded with the cell name and the goroutine aborts. Without the srv vschema the explain cannot resolve routing, so this contributes to a failed request.

Source

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

		schema = strings.Join(schemas, ";")
	}(c)

	// GetSrvVSchema
	go func(c *cluster.Cluster) {
		defer wg.Done()

		span, ctx := trace.NewSpan(ctx, "Cluster.GetSrvVSchema")
		defer span.Finish()

		span.Annotate("cell", tablet.Tablet.Alias.Cell)
		cluster.AnnotateSpan(c, span)

		res, err := c.Vtctld.GetSrvVSchema(ctx, &vtctldatapb.GetSrvVSchemaRequest{
			Cell: tablet.Tablet.Alias.Cell,
		})
		if err != nil {
			er.RecordError(fmt.Errorf("GetSrvVSchema(%s): %w", tablet.Tablet.Alias.Cell, err))
			return
		}

		ksvs, ok := res.SrvVSchema.Keyspaces[req.Keyspace]
		if !ok {
			er.RecordError(fmt.Errorf("%w: keyspace %s", errors.ErrNoSrvVSchema, req.Keyspace))
			return
		}

		ksvsb, err := json.Marshal(&ksvs)
		if err != nil {
			er.RecordError(err)
			return
		}

		srvVSchema = fmt.Sprintf(`{"%s": %s}`, req.Keyspace, string(ksvsb))
	}(c)

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Verify vtctld is running and reachable at the address configured in vtadmin's cluster config.
  2. Retry the request once vtctld is healthy.
  3. Check topo (etcd/zk) health for the cell named in the error.
  4. Test manually: `vtctldclient --server <vtctld> GetSrvVSchema --cell <cell>`.
  5. If the cell name is wrong/uncommon, check the tablet alias cell and the cluster's cells configuration.

Example fix

// before
res, err := c.Vtctld.GetSrvVSchema(ctx, &vtctldatapb.GetSrvVSchemaRequest{Cell: tablet.Tablet.Alias.Cell})
// err: rpc unavailable
// after: point vtadmin at a healthy vtctld
"vtctld": {"addresses": ["localhost:15999"]} // correct, running vtctld
Defensive patterns

Strategy: retry

Validate before calling

// Probe vtctld connectivity first
conn, err := grpc.DialContext(ctx, vtctldAddr, grpc.WithBlock(), grpc.WithTimeout(2*time.Second))
if err != nil { return fmt.Errorf("vtctld %s unreachable: %w", vtctldAddr, err) }

Try / catch

res, err := c.Vtctld.GetSrvVSchema(ctx, reqCell)
if err != nil {
    if st, ok := status.FromError(err); ok && st.Code() == codes.Unavailable {
        // retry with backoff or fail over to another vtctld
        return retryWithBackoff(3, time.Second, func() error { ... })
    }
    return fmt.Errorf("GetSrvVSchema(%s): %w", cell, err)
}

Prevention

When it happens

Trigger: The GetSrvVSchema goroutine calls c.Vtctld.GetSrvVSchema for the tablet's cell and the RPC returns an error — vtctld unreachable, timeout, or topo read failure in that cell.

Common situations: vtctld is down or being restarted; vtadmin cannot reach vtctld's gRPC port; etcd/zk for the named cell is degraded; misconfigured vtctld address in vtadmin's cluster config.

Related errors


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