{"record":{"id":"9330971474d7b36c","repo":"vitessio/vitess","slug":"force-cut-over-after-is-only-valid-in-vitess-s","errorCode":null,"errorMessage":"--force-cut-over-after is only valid in 'vitess' strategy. Found %v value in '%v' strategy","messagePattern":"--force-cut-over-after is only valid in 'vitess' strategy\\. Found (.+?) value in '(.+?)' strategy","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/schema/ddl_strategy.go","lineNumber":148,"sourceCode":"\t}\n\tif _, err := setting.CutOverThreshold(); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := setting.RetainArtifactsDuration(); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := setting.SessionVariables(); err != nil {\n\t\treturn nil, err\n\t}\n\tcutoverAfter, err := setting.ForceCutOverAfter()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch setting.Strategy {\n\tcase DDLStrategyVitess, DDLStrategyOnline:\n\tdefault:\n\t\tif cutoverAfter != 0 {\n\t\t\treturn nil, fmt.Errorf(\"--force-cut-over-after is only valid in 'vitess' strategy. Found %v value in '%v' strategy\", cutoverAfter, setting.Strategy)\n\t\t}\n\t}\n\n\tswitch setting.Strategy {\n\tcase DDLStrategyVitess, DDLStrategyOnline, DDLStrategyMySQL, DDLStrategyDirect:\n\t\tif opts := setting.RuntimeOptions(); len(opts) > 0 {\n\t\t\treturn nil, fmt.Errorf(\"invalid flags for %v strategy: %s\", setting.Strategy, strings.Join(opts, \" \"))\n\t\t}\n\t}\n\n\treturn setting, nil\n}\n\n// isFlag return true when the given string is a CLI flag of the given name\nfunc isFlag(s string, name string) bool {\n\tif s == \"-\"+name {\n\t\treturn true\n\t}","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/schema/ddl_strategy.go#L130-L166","documentation":"ParseDDLStrategy rejects the --force-cut-over-after parameter when the selected strategy is not 'vitess' (or 'online', an alias). That cutover-control parameter is only meaningful for vitess-managed online DDL, so any nonzero value with mysql/direct strategies errors.","triggerScenarios":"SET @@ddl_strategy='mysql --force-cut-over-after=24h' or 'direct --force-cut-over-after=...' — a nonzero cutoverAfter parsed while setting.Strategy is mysql or direct.","commonSituations":"Copy-pasting a vitess strategy string and editing only the strategy token, forgetting to remove parameters; automation templates appending --force-cut-over-after to every strategy; misunderstanding that mysql/direct run native DDL so forced cutover is meaningless.","solutions":["Remove --force-cut-over-after from the ddl_strategy value, e.g. SET @@ddl_strategy='mysql'.","Switch to strategy 'vitess' or 'online' if you actually want controlled cutover with --force-cut-over-after.","Fix automation that injects vitess-specific flags into non-vitess strategies.","Use valid syntax SET @@ddl_strategy='vitess --force-cut-over-after=24h' when intended."],"exampleFix":"// before\nSET @@ddl_strategy='mysql --force-cut-over-after=24h';\n// after\nSET @@ddl_strategy='vitess --force-cut-over-after=24h'; // or drop the flag","handlingStrategy":"validation","validationCode":"s := schema.ParseDDLStrategy(strategyName)\nif (strategy == \"mysql\" || strategy == \"direct\") && strings.Contains(strategyName, \"--force-cut-over-after\") {\n  return errors.New(\"--force-cut-over-after requires vitess/online strategy\")\n}","typeGuard":"func cutoverAllowed(s *schema.DDLStrategySetting) bool {\n  return s.Strategy == schema.DDLStrategyVitess || s.Strategy == schema.DDLStrategyOnline\n}","tryCatchPattern":"setting, err := schema.ParseDDLStrategy(v)\nif err != nil { return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, \"ddl_strategy invalid: %v\", err) }","preventionTips":["Only append --force-cut-over-after to vitess/online strategies","Keep DDL strategy templates per-strategy, not shared"],"tags":["ddl","online-schema-change","flags"],"backgroundTag":"invalid-ddl-strategy","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}