{"record":{"id":"476cce5915a7cc49","repo":"vitessio/vitess","slug":"schema-change-failed-executeresult-v","errorCode":null,"errorMessage":"schema change failed, ExecuteResult: %v","messagePattern":"schema change failed, ExecuteResult: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/schemamanager/schemamanager.go","lineNumber":133,"sourceCode":"\tdefer executor.Close()\n\tif err := executor.Validate(ctx, sqls); err != nil {\n\t\tlog.Error(fmt.Sprintf(\"validation fail: %v\", err))\n\t\tcontroller.OnValidationFail(ctx, err)\n\t\treturn execResult, err\n\t}\n\n\tif err := controller.OnValidationSuccess(ctx); err != nil {\n\t\treturn execResult, err\n\t}\n\n\texecResult = executor.Execute(ctx, sqls)\n\n\tif err := controller.OnExecutorComplete(ctx, execResult); err != nil {\n\t\treturn execResult, err\n\t}\n\tif execResult.ExecutorErr != \"\" || len(execResult.FailedShards) > 0 {\n\t\tout, _ := json.MarshalIndent(execResult, \"\", \"  \")\n\t\treturn execResult, fmt.Errorf(\"schema change failed, ExecuteResult: %v\", string(out))\n\t}\n\treturn execResult, nil\n}\n\n// RegisterControllerFactory register a control factory.\nfunc RegisterControllerFactory(name string, factory ControllerFactory) {\n\tif _, ok := controllerFactories[name]; ok {\n\t\tpanic(\"register a registered key: \" + name)\n\t}\n\tcontrollerFactories[name] = factory\n}\n\n// GetControllerFactory gets a ControllerFactory.\nfunc GetControllerFactory(name string) (ControllerFactory, error) {\n\tfactory, ok := controllerFactories[name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"there is no data sourcer factory with name: %s\", name)\n\t}","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/schemamanager/schemamanager.go#L115-L151","documentation":"schemamanager's Run completes and reports failure via a single error summarizing the ExecuteResult: either the executor reported an error string (ExecutorErr) or some shards failed. The full marshaled ExecuteResult JSON is embedded in the message so operators can see per-shard outcomes.","triggerScenarios":"Running a schema change where TabletExecutor sets ExecutorErr (e.g. a migration failed on a tablet) or FailedShards is non-empty after applying statements to the keyspace.","commonSituations":"Online DDL migration failed on one or more shards; session or tablet errors during ALTER; a partially applied schema change where some primaries rejected the statement.","solutions":["Parse the ExecuteResult JSON in the error message to find ExecutorErr and the failed shards list","Inspect the failing tablets' logs (vttablet) for the underlying migration error","Retry/revert the failed migration (e.g. vtctldclient UndoMigration or RetryMigration with the UUID) and re-run"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"result, err := mgr.Run(ctx)\nif err != nil {\n  var execRes *schemamanager.ExecuteResult\n  if errors.As(err, &execRes) || strings.HasPrefix(err.Error(), \"schema change failed\") {\n    // parse JSON from the message for ExecutorErr and FailedShards\n  }\n}","preventionTips":["Monitor ExecuteResult.FailedShards to alert on partial application","Test migrations on staging keyspace first","Keep vttablet logs correlated with migration UUIDs"],"tags":["schemamanager","execution","shards","online-ddl"],"backgroundTag":"schema-migration-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}