{"record":{"id":"25efa08cf64504d0","repo":"vitessio/vitess","slug":"unknown-enum-name-for-schemamigration-status-s","errorCode":null,"errorMessage":"unknown enum name for SchemaMigration_Status: %s","messagePattern":"unknown enum name for SchemaMigration_Status: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/schematools/schematools.go","lineNumber":72,"sourceCode":"\t\treturn vtctldatapb.SchemaMigration_DIRECT, nil\n\t}\n\n\tupperName := strings.ToUpper(name)\n\tstrategy, ok := vtctldatapb.SchemaMigration_Strategy_value[upperName]\n\tif !ok {\n\t\treturn 0, fmt.Errorf(\"unknown schema migration strategy: '%v'\", name)\n\t}\n\n\treturn vtctldatapb.SchemaMigration_Strategy(strategy), nil\n}\n\n// ParseSchemaMigrationStatus parses the given status into the underlying enum type.\nfunc ParseSchemaMigrationStatus(name string) (vtctldatapb.SchemaMigration_Status, error) {\n\tkey := strings.ToUpper(name)\n\n\tval, ok := vtctldatapb.SchemaMigration_Status_value[key]\n\tif !ok {\n\t\treturn 0, fmt.Errorf(\"unknown enum name for SchemaMigration_Status: %s\", name)\n\t}\n\n\treturn vtctldatapb.SchemaMigration_Status(val), nil\n}\n\n// SchemaMigrationStrategyName returns the text-based form of the strategy.\nfunc SchemaMigrationStrategyName(strategy vtctldatapb.SchemaMigration_Strategy) string {\n\tname, ok := vtctldatapb.SchemaMigration_Strategy_name[int32(strategy)]\n\tif !ok {\n\t\treturn \"unknown\"\n\t}\n\treturn strings.ToLower(name)\n}\n\n// SchemaMigrationStatusName returns the text-based form of the status.\nfunc SchemaMigrationStatusName(status vtctldatapb.SchemaMigration_Status) string {\n\treturn strings.ToLower(vtctldatapb.SchemaMigration_Status_name[int32(status)])\n}","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/schematools/schematools.go#L54-L90","documentation":"ParseSchemaMigrationStatus converts a status name string into the vtctldatapb.SchemaMigration_Status enum via an exact upper-case map lookup. When the provided name is not a defined status (e.g. not \"running\", \"complete\", \"failed\", \"cancelled\", \"queued\"), this error is returned. It is input validation and does not indicate any migration actually ran.","triggerScenarios":"commandOnlineDDLShow with a `-status` filter value that is not a defined enum name, or rowToSchemaMigration reading a status string from persistence that no longer matches current enum names.","commonSituations":"Typo in `vtctldclient OnlineDDL show -status`; status string from an older schema/migration table written by a different Vitess version; lowercase/mixed formatting with stray spaces defeating the exact-match lookup.","solutions":["Use an exact valid status name per vtctldatapb.SchemaMigration_Status in proto/vtctldata.proto.","Trim/normalize the input string before parsing.","If migrating stored data, map legacy status names to current enum names before calling the parser.","Enumerate valid keys via vtctldatapb.SchemaMigration_Status_value to confirm spelling."],"exampleFix":"// before\nstatus, err := schematools.ParseSchemaMigrationStatus(\"succes\") // typo\n// after\nstatus, err := schematools.ParseSchemaMigrationStatus(\"complete\")","handlingStrategy":"validation","validationCode":"validStatuses := map[string]bool{\"queued\": true, \"running\": true, \"complete\": true, \"failed\": true, \"cancelled\": true}\nif !validStatuses[strings.ToLower(strings.TrimSpace(statusName))] {\n  return fmt.Errorf(\"status %q not recognized\", statusName)\n}","typeGuard":"func isValidMigrationStatus(name string) bool {\n  _, ok := vtctldatapb.SchemaMigration_Status_value[strings.ToUpper(strings.TrimSpace(name))]\n  return ok\n}","tryCatchPattern":"status, err := schematools.ParseSchemaMigrationStatus(name)\nif err != nil {\n  return fmt.Errorf(\"bad -status filter %q: %w (see SchemaMigration_Status enum)\", name, err)\n}","preventionTips":["Use tab-completion or documented enum values for OnlineDDL show -status.","Normalize (trim/upper) status strings from external sources before parsing.","When upgrading Vitess, remap any persisted legacy status names to current enums.","Validate enum inputs at the CLI boundary with ParseSchemaMigrationStatus before issuing commands."],"tags":["validation","enum","online-ddl","schema-migration"],"backgroundTag":"invalid-enum-value","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}