vitessio/vitess · error

missing keyspace %q in cell %q

Error message

missing keyspace %q in cell %q

What it means

GetSrvVSchema/GetKeyspace serving lookup returned the topo response, but the SrvKeyspaces map has no entry for the requested cell (nil value). The command refuses to print JSON for a missing serving-keyspace record. Indicates the keyspace has no tablets serving in that cell.

Source

Thrown at go/vt/vtctl/vtctl.go:3590

	}
	if subFlags.NArg() != 2 {
		return errors.New("the <cell> and <keyspace> arguments are required for the GetSrvKeyspace command")
	}

	cell := subFlags.Arg(0)
	keyspace := subFlags.Arg(1)

	resp, err := wr.VtctldServer().GetSrvKeyspaces(ctx, &vtctldatapb.GetSrvKeyspacesRequest{
		Keyspace: keyspace,
		Cells:    []string{cell},
	})
	if err != nil {
		return err
	}

	cellKs := resp.SrvKeyspaces[cell]
	if cellKs == nil {
		return fmt.Errorf("missing keyspace %q in cell %q", keyspace, cell)
	}
	return printJSON(wr.Logger(), cellKs)
}

func commandUpdateThrottlerConfig(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) (err error) {
	enable := subFlags.Bool("enable", false, "Enable the throttler")
	disable := subFlags.Bool("disable", false, "Disable the throttler")
	threshold := subFlags.Float64("threshold", 0, "threshold for the either default check (replication lag seconds) or custom check")
	customQuery := subFlags.String("custom-query", "", "custom throttler check query")
	unthrottledApp := subFlags.String("unthrottle-app", "", "an app name to unthrottle")
	throttledApp := subFlags.String("throttle-app", "", "an app name to throttle")
	throttledAppRatio := subFlags.Float64("throttle-app-ratio", throttle.DefaultThrottleRatio, "ratio to throttle app (app specififed in --throttled-app)")
	throttledAppDuration := subFlags.Duration("throttle-app-duration", throttle.DefaultAppThrottleDuration, "duration after which throttled app rule expires (app specified in --throttled-app)")
	throttledAppExempt := subFlags.Bool("throttle-app-exempt", false, "exempt this app from being at all throttled. WARNING: use with extreme care, as this is likely to push metrics beyond the throttler's threshold, and starve other apps (app specified in --throttled-app)")
	if err := subFlags.Parse(args); err != nil {
		return err
	}
	customQuerySet := subFlags.Changed("custom-query")

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Verify the cell name is correct (`vtctldclient GetSrvKeyspaces` without --cell lists all)
  2. Check tablets exist in that cell: `vtctldclient GetTablets --cell <cell>`
  3. Rebuild the serving graph for the cell: `vtctldclient RebuildKeyspaceGraph <keyspace> --cells=<cell>`

Example fix

// before
vtctldclient GetSrvKeyspaces commerce --cell region-us-typo
// after
vtctldclient GetSrvKeyspaces commerce --cell region-us-1
Defensive patterns

Strategy: validation

Validate before calling

resp, err := wr.TopoServer().GetSrvKeyspaces(ctx, keyspace)
if err == nil && (resp == nil || resp.SrvKeyspaces[cell] == nil) {
	return fmt.Errorf("keyspace %s not serving in cell %s; run RebuildKeyspaceGraph", keyspace, cell)
}

Try / catch

if err := getSrvKeyspaces(ks, cell); err != nil {
	if strings.Contains(err.Error(), "missing keyspace") {
		// fall back to listing all cells to diagnose
	}
	return err
}

Prevention

When it happens

Trigger: Calling `vtctldclient GetSrvKeyspaces <keyspace> --cell <cell>` (code path at vtctl.go:3590) where resp.SrvKeyspaces[cell] is nil because no serving keyspace object exists in that cell.

Common situations: Querying a cell where the keyspace has no tablets; typo in --cell name; new cell added before any tablets were deployed; srv keyspace record not yet rebuilt after RefreshState.

Related errors


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