{"record":{"id":"fbacd9f595b3b525","repo":"vitessio/vitess","slug":"don-t-know-how-to-advance-from-s-to-s","errorCode":null,"errorMessage":"don't know how to advance from %s to %s","messagePattern":"don't know how to advance from (.+?) to (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletmanager/vreplication/vcopier.go","lineNumber":1194,"sourceCode":"\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif err := vbc.insertCopyState(ctx, args.lastpk); err != nil {\n\t\t\t\t\treturn vterrors.Wrapf(err, \"error updating _vt.copy_state\")\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase vcopierCopyTaskCommit:\n\t\t\tadvanceFn = func(context.Context, *vcopierCopyTaskArgs) error {\n\t\t\t\t// Commit.\n\t\t\t\tif err := vbc.Commit(); err != nil {\n\t\t\t\t\treturn vterrors.Wrapf(err, \"error committing transaction\")\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase vcopierCopyTaskComplete:\n\t\t\tadvanceFn = func(context.Context, *vcopierCopyTaskArgs) error { return nil }\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"don't know how to advance from %s to %s\", state, nextState)\n\t\t\tstate = vcopierCopyTaskFail\n\t\t\tgoto END\n\t\t}\n\n\t\t// tryAdvance tries to execute advanceFn, and also executes any\n\t\t// lifecycle hooks surrounding the provided state.\n\t\t//\n\t\t// If all lifecycle hooks and advanceFn are successfully executed,\n\t\t// tryAdvance will return state, which should be == the nextState that\n\t\t// we provided.\n\t\t//\n\t\t// If there was a failure executing lifecycle hooks or advanceFn,\n\t\t// tryAdvance will return a failure state (i.e. canceled or failed),\n\t\t// along with a diagnostic error.\n\t\tif state, err = task.lifecycle.tryAdvance(ctx, task.args, nextState, advanceFn); err != nil {\n\t\t\tgoto END\n\t\t}\n\t}","sourceCodeStart":1176,"sourceCodeEnd":1212,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletmanager/vreplication/vcopier.go#L1176-L1212","documentation":"vcopier's copy-task state machine maps each (state, nextState) pair to an advanceFn. If the machine reaches a state/next combination with no defined transition, it errors 'don't know how to advance', moves to vcopierCopyTaskFail, and jumps to END to fail the task. This indicates an unexpected state transition, i.e. an internal bug rather than user error.","triggerScenarios":"A copy task transitions to a nextState not covered by the switch on task state (e.g. an undefined intermediate state reached due to a logic bug or unexpected worker result).","commonSituations":"Vitess version bug in the copy-task state machine; corrupted worker results causing abnormal transitions; race between worker completion and task state updates.","solutions":["Capture full vttablet logs including prior state names and report a bug with the workflow type and state sequence","Restart the workflow copy phase to reset task state","Upgrade/patch to a Vitess version where the state machine handles the missing transition","Avoid altering copy state rows in _vt.copy_state manually while tasks run"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := task.run(ctx); err != nil {\n  if strings.Contains(err.Error(), \"don't know how to advance\") {\n    // internal state-machine bug: capture logs, fail the task,\n    // restart the copy phase to reset state\n  }\n  return err\n}","preventionTips":["Keep Vitess upgraded to versions with state-machine fixes","Never hand-edit _vt.copy_state while tasks run","Report the state sequence to maintainers when seen"],"tags":["vreplication","vcopier","state-machine","internal-bug"],"backgroundTag":"copy-task-invalid-state-transition","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}