{"record":{"id":"6bb4fa5a0a4924a5","repo":"vitessio/vitess","slug":"unknown-gc-state-s","errorCode":null,"errorMessage":"Unknown GC state: %s","messagePattern":"Unknown GC state: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/schema/tablegc.go","lineNumber":136,"sourceCode":"\t\treturn \"\", \"\", err\n\t}\n\treturn fmt.Sprintf(\"RENAME TABLE `%s` TO %s\", fromTableName, toTableName), toTableName, nil\n}\n\n// GenerateRenameStatement generates a \"RENAME TABLE\" statement, where a table is renamed to a GC table.\nfunc GenerateRenameStatement(fromTableName string, state TableGCState, t time.Time) (statement string, toTableName string, err error) {\n\treturn GenerateRenameStatementWithUUID(fromTableName, state, \"\", t)\n}\n\n// ParseGCLifecycle parses a comma separated list of gc states and returns a map of indicated states\nfunc ParseGCLifecycle(gcLifecycle string) (states map[TableGCState]bool, err error) {\n\tstates = make(map[TableGCState]bool)\n\ttokens := textutil.SplitDelimitedList(gcLifecycle)\n\tfor _, token := range tokens {\n\t\ttoken = strings.ToUpper(token)\n\t\tstate, ok := gcStates[token]\n\t\tif !ok {\n\t\t\treturn states, fmt.Errorf(\"Unknown GC state: %s\", token)\n\t\t}\n\t\tstates[state] = true\n\t}\n\t// DROP is implicitly included.\n\tstates[DropTableGCState] = true\n\treturn states, nil\n}\n","sourceCodeStart":118,"sourceCodeEnd":144,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/schema/tablegc.go#L118-L144","documentation":"ParseGCLifecycle parses a comma/space-delimited --gc_lifecycle value by uppercasing each token and looking it up in gcStates. This error means one of the tokens is not a recognized GC state name (e.g. \"hold,purp\"), so the lifecycle set cannot be built.","triggerScenarios":"Setting the vttablet --gc_lifecycle flag (or lifecycle config reaching Open/newFakeDBTableGC) with an unrecognized token, e.g. --gc_lifecycle=\"drop,purrg\"; tokens are uppercased before lookup so case itself is not the problem.","commonSituations":"Typo in tablet deployment flags/Helm charts; copying state names from older Vitess versions with renamed values; whitespace variants that SplitDelimitedList doesn't trim as expected.","solutions":["Use valid state tokens: e.g. \"hold,purge,drop\" — check gcStates in go/vt/schema/tablegc.go for the exact set.","Fix the typo in the --gc_lifecycle flag in your tablet startup config.","If parsing programmatically, validate tokens against gcStates before calling ParseGCLifecycle."],"exampleFix":"// before\ntl.InitTablet(\"... --gc_lifecycle hold,purrg\")\n// after\ntl.InitTablet(\"... --gc_lifecycle hold,purge\")","handlingStrategy":"validation","validationCode":"for _, tok := range strings.Split(gcLifecycle, \",\") {\n    if _, ok := schema.GCStateNames[strings.ToUpper(strings.TrimSpace(tok))]; !ok {\n        // fix the flag value before starting the tablet\n    }\n}","typeGuard":null,"tryCatchPattern":"states, err := schema.ParseGCLifecycle(gcLifecycle)\nif err != nil {\n    return fmt.Errorf(\"invalid --gc_lifecycle: %w\", err)\n}","preventionTips":["Use documented tokens (e.g. hold, purge, drop) in tablet flags.","Keep --gc_lifecycle values in Helm/config templates under review against the current enum.","Fail fast on startup config with a pre-parse check."],"tags":["tablet","gc","config","parsing"],"backgroundTag":"unknown-gc-state","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}