{"record":{"id":"9ec5c33db202fea1","repo":"vitessio/vitess","slug":"served-type-has-to-be-in-the-serving-graph-not-v","errorCode":null,"errorMessage":"served_type has to be in the serving graph, not %v","messagePattern":"served_type has to be in the serving graph, not (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/tablet.go","lineNumber":666,"sourceCode":"\t\t}\n\t\treturn nil\n\t}\n\treturn err\n}\n\n// ParseServingTabletType parses the tablet type into the enum, and makes sure\n// that the enum is of serving type (PRIMARY, REPLICA, RDONLY/BATCH).\n//\n// Note: This function more closely belongs in topoproto, but that would create\n// a circular import between packages topo and topoproto.\nfunc ParseServingTabletType(param string) (topodatapb.TabletType, error) {\n\tservedType, err := topoproto.ParseTabletType(param)\n\tif err != nil {\n\t\treturn topodatapb.TabletType_UNKNOWN, err\n\t}\n\n\tif !IsInServingGraph(servedType) {\n\t\treturn topodatapb.TabletType_UNKNOWN, fmt.Errorf(\"served_type has to be in the serving graph, not %v\", param)\n\t}\n\n\treturn servedType, nil\n}\n","sourceCodeStart":648,"sourceCodeEnd":671,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/tablet.go#L648-L671","documentation":"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.","triggerScenarios":"vtctldclient commands commandUpdateSrvKeyspacePartition or commandSetShardTabletControl invoked with served_type set to a non-serving tablet type such as SPARE, BACKUP, RESTORE, or DRAINED.","commonSituations":"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.","solutions":["Use a serving type for served_type: REPLICA, RDONLY, SPARE (see topodatapb.TabletType with IsInServingGraph semantics)","Fix typos in the --served_type flag value","If the intent was to exclude a type from serving, use the appropriate command semantics rather than passing a non-serving type"],"exampleFix":"// before\nvtctldclient SetShardTabletControl --served_types=BACKUP commerce/0\n// after\nvtctldclient SetShardTabletControl --served_types=REPLICA commerce/0","handlingStrategy":"validation","validationCode":"t, err := topoproto.ParseTabletType(servedTypeStr)\nif err == nil && !topo.IsInServingGraph(t) {\n    return fmt.Errorf(\"%v is not a serving type\", servedTypeStr)\n}","typeGuard":"func isServingTypeStr(s string) bool {\n    t, err := topoproto.ParseTabletType(s)\n    return err == nil && topo.IsInServingGraph(t)\n}","tryCatchPattern":"servedType, err := topoproto.ParseServingTabletType(flagValue)\nif err != nil {\n    return fmt.Errorf(\"bad --served_type %q: %w\", flagValue, err)\n}","preventionTips":["Only pass PRIMARY/REPLICA/RDONLY/SPARE to served_type flags","Validate type strings with ParseServingTabletType before scripting bulk updates","Read IsInServingGraph docs to know which types are excluded"],"tags":["topo","tablet-type","cli-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}