{"record":{"id":"432edf833dcd0415","repo":"vitessio/vitess","slug":"error-parsing-table-gc-lifecycle-flag-v","errorCode":null,"errorMessage":"Error parsing --table-gc-lifecycle flag: %+v","messagePattern":"Error parsing --table-gc-lifecycle flag: %\\+v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletserver/gc/tablegc.go","lineNumber":193,"sourceCode":"\tcollector.shard = shard\n\tcollector.dbName = dbName\n}\n\n// Open opens database pool and initializes the schema\nfunc (collector *TableGC) Open() (err error) {\n\tcollector.stateMutex.Lock()\n\tdefer collector.stateMutex.Unlock()\n\tif collector.isOpen > 0 {\n\t\t// already open\n\t\treturn nil\n\t}\n\tif !collector.env.Config().EnableTableGC {\n\t\treturn nil\n\t}\n\n\tcollector.lifecycleStates, err = schema.ParseGCLifecycle(gcLifecycle)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error parsing --table-gc-lifecycle flag: %+v\", err)\n\t}\n\n\tlog.Info(\"TableGC: opening\")\n\tcollector.pool.Open(collector.env.Config().DB.AllPrivsWithDB(), collector.env.Config().DB.DbaWithDB(), collector.env.Config().DB.AppDebugWithDB())\n\tatomic.StoreInt64(&collector.isOpen, 1)\n\n\tconn, err := dbconnpool.NewDBConnection(context.Background(), collector.env.Config().DB.AllPrivsWithDB())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\tcollector.lifecycleStates, err = adjustLifecycleForFastDrops(conn, collector.lifecycleStates)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Info(fmt.Sprintf(\"TableGC: MySQL version=%v, lifecycleStates=%v\", conn.ServerVersion, collector.lifecycleStates))\n\n\tctx := context.Background()","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/gc/tablegc.go#L175-L211","documentation":"Raised during tabletserver (TableGC) Open when the --table-gc-lifecycle flag string cannot be parsed by schema.ParseGCLifecycle. The flag must be a comma-separated list of valid GC lifecycle states (e.g. hold,purge,evac,drop); anything invalid aborts the TableGC collector startup.","triggerScenarios":"Starting vttablet (or env.Config call path) with --table-gc-lifecycle containing a typo'd or unknown state name, wrong separator (spaces/semicolons), or malformed syntax so ParseGCLifecycle returns an error.","commonSituations":"Config mistakes after renaming lifecycle states across Vitess versions; copy-pasted flag values from docs of a different version; trailing commas or whitespace-only entries.","solutions":["Fix --table-gc-lifecycle to a valid comma-separated list of supported states (e.g. 'purge,evac,drop')","Check the wrapped %+v error in the message for the exact offending token","Verify allowed state names against schema.ParseGCLifecycle for your Vitess version","Remove the flag to use the default lifecycle set"],"exampleFix":"// before\n--table-gc-lifecycle \"purge; evac\"\n// after\n--table-gc-lifecycle \"purge,evac\"","handlingStrategy":"validation","validationCode":"// validate before launch\nif os.Getenv(\"TABLE_GC_LIFECYCLE\") != \"\" {\n    if _, err := schema.ParseGCLifecycle(os.Getenv(\"TABLE_GC_LIFECYCLE\")); err != nil {\n        panic(fmt.Sprintf(\"bad --table-gc-lifecycle: %v\", err))\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only documented lifecycle state names separated by commas","Pin flag values to your Vitess version's supported states","Validate flags in a pre-start config check"],"tags":["config","flag-parsing","table-gc","tabletserver"],"backgroundTag":"invalid-flag-value","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}