vitessio/vitess · error

opts %+v, err: %w

Error message

opts %+v, err: %w

What it means

In Cluster.GetSchema's per-keyspace fan-out, after FindTablets/getTabletsToQueryForSchemas fails, the error is recorded with the full GetSchema options attached for debugging. ErrNoServingTablet is deliberately logged at info and skipped; everything else is recorded as a real error.

Source

Thrown at go/vt/vtadmin/cluster/cluster.go:1570

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

	// Now, fan out to collect the schemas.
	for _, ks := range keyspaces {
		wg.Add(1)
		go func(ctx context.Context, ks *vtadminpb.Keyspace) {
			defer wg.Done()

			tablets, err := c.getTabletsToQueryForSchemas(ctx, ks.Keyspace.Name, tablets, opts)
			if err != nil {
				// Ignore keyspaces without any serving tablets.
				if stderrors.Is(err, errors.ErrNoServingTablet) {
					log.Info(err.Error())
					return
				}

				rec.RecordError(fmt.Errorf("opts %+v, err: %w", opts, err))
				return
			}

			schema, err := c.getSchemaFromTablets(ctx, ks.Keyspace.Name, tablets, opts)
			if err != nil {
				rec.RecordError(err)
				return
			}

			// Ignore keyspaces without schemas
			if schema == nil {
				log.Info("No schemas for " + ks.Keyspace.Name)
				return
			}

			if len(schema.TableDefinitions) == 0 {
				log.Info("No tables in schema for " + ks.Keyspace.Name)
				return

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Read the recorded message: opts identify which keyspace/tablet filter failed and the wrapped err gives the cause
  2. Retry after topology stabilizes (reshard/reparent transient states)
  3. Validate GetSchema opts (keyspace/tablet type filters) before issuing the request
  4. If ErrNoServingTablet was the real cause, check whether the keyspace is expected to serve
Defensive patterns

Strategy: type-guard

Validate before calling

// Go: validate GetSchema opts before calling
if req.Keyspace == "" && len(req.Tablets) == 0 {
	return fmt.Errorf("GetSchema opts must target a keyspace or tablets")
}

Type guard

func isNoServingTablet(err error) bool {
	return errors.Is(err, errors.ErrNoServingTablet) // library skips this case
}
func isTabletSelectionErr(err error) bool {
	return strings.Contains(err.Error(), "opts +")
}

Try / catch

schema, err := c.GetSchema(ctx, req)
if err != nil {
	if strings.Contains(err.Error(), "opts +") {
		// parse opts/cause from message; retry after topo stabilizes
	}
	return err
}

Prevention

When it happens

Trigger: getSchemaForKeyspace fails for a keyspace with anything other than ErrNoServingTablet: FindTablets topo errors, or getTabletsToQueryForSchemas failures (tablet selection errors) — recorded as 'opts %+v, err: ...'.

Common situations: Tablet topology in flux during a reshard/reparent while schema is fetched; topo read errors mid-fan-out; invalid opts (bad keyspace/tablet filters) causing tablet selection to fail.

Related errors


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