vitessio/vitess · error

served_type has to be in the serving graph, not %v

Error message

served_type has to be in the serving graph, not %v

What it means

ParseServingTabletType parsed the given type string successfully but the tablet type is not one that participates in the serving graph (e.g. BACKUP, RESTORE, DRAINED). Commands that configure the srvkeyspace partition or shard tablet controls only accept serving types like REPLICA, RDONLY, SPARE.

Source

Thrown at go/vt/topo/tablet.go:666

		}
		return nil
	}
	return err
}

// ParseServingTabletType parses the tablet type into the enum, and makes sure
// that the enum is of serving type (PRIMARY, REPLICA, RDONLY/BATCH).
//
// Note: This function more closely belongs in topoproto, but that would create
// a circular import between packages topo and topoproto.
func ParseServingTabletType(param string) (topodatapb.TabletType, error) {
	servedType, err := topoproto.ParseTabletType(param)
	if err != nil {
		return topodatapb.TabletType_UNKNOWN, err
	}

	if !IsInServingGraph(servedType) {
		return topodatapb.TabletType_UNKNOWN, fmt.Errorf("served_type has to be in the serving graph, not %v", param)
	}

	return servedType, nil
}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Use a serving type for served_type: REPLICA, RDONLY, SPARE (see topodatapb.TabletType with IsInServingGraph semantics)
  2. Fix typos in the --served_type flag value
  3. If the intent was to exclude a type from serving, use the appropriate command semantics rather than passing a non-serving type

Example fix

// before
vtctldclient SetShardTabletControl --served_types=BACKUP commerce/0
// after
vtctldclient SetShardTabletControl --served_types=REPLICA commerce/0
Defensive patterns

Strategy: validation

Validate before calling

t, err := topoproto.ParseTabletType(servedTypeStr)
if err == nil && !topo.IsInServingGraph(t) {
    return fmt.Errorf("%v is not a serving type", servedTypeStr)
}

Type guard

func isServingTypeStr(s string) bool {
    t, err := topoproto.ParseTabletType(s)
    return err == nil && topo.IsInServingGraph(t)
}

Try / catch

servedType, err := topoproto.ParseServingTabletType(flagValue)
if err != nil {
    return fmt.Errorf("bad --served_type %q: %w", flagValue, err)
}

Prevention

When it happens

Trigger: vtctldclient commands commandUpdateSrvKeyspacePartition or commandSetShardTabletControl invoked with served_type set to a non-serving tablet type such as SPARE, BACKUP, RESTORE, or DRAINED.

Common situations: Typo or confusion between tablet roles; copy-pasting a tablet's current type (which may be BACKUP during a backup) into a served_type flag; scripting partition updates from GetTablet output.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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