{"record":{"id":"0f88566ae4f28314","repo":"vitessio/vitess","slug":"found-an-entry-from-a-previous-run-for-migration-i","errorCode":null,"errorMessage":"found an entry from a previous run for migration id %d in _vt.resharding_journal of tablets %s,please review and delete it before proceeding and restart the workflow using the Workflow %s.%s start","messagePattern":"found an entry from a previous run for migration id (.+?) in _vt\\.resharding_journal of tablets (.+?),please review and delete it before proceeding and restart the workflow using the Workflow (.+?)\\.(.+?) start","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/materializer.go","lineNumber":358,"sourceCode":"\t}\n\n\tmigrationID, err := getMigrationID(targetKeyspace, tabletShards)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif externalCluster == \"\" {\n\t\texists, tablets, err := wr.checkIfPreviousJournalExists(ctx, mz, migrationID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif exists {\n\t\t\twr.Logger().Errorf(\"Found a previous journal entry for %d\", migrationID)\n\t\t\tmsg := fmt.Sprintf(\"found an entry from a previous run for migration id %d in _vt.resharding_journal of tablets %s,\",\n\t\t\t\tmigrationID, strings.Join(tablets, \",\"))\n\t\t\tmsg += fmt.Sprintf(\"please review and delete it before proceeding and restart the workflow using the Workflow %s.%s start\",\n\t\t\t\tworkflow, targetKeyspace)\n\t\t\treturn errors.New(msg)\n\t\t}\n\t}\n\tif autoStart {\n\t\treturn mz.startStreams(ctx)\n\t}\n\twr.Logger().Infof(\"Streams will not be started since --auto_start is set to false\")\n\n\treturn nil\n}\n\nfunc (wr *Wrangler) validateSourceTablesExist(sourceKeyspace string, ksTables, tables []string) error {\n\t// validate that tables provided are present in the source keyspace\n\tvar missingTables []string\n\tfor _, table := range tables {\n\t\tif schema.IsInternalOperationTableName(table) {\n\t\t\tcontinue\n\t\t}\n\t\tfound := slices.Contains(ksTables, table)","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/materializer.go#L340-L376","documentation":"Before starting MoveTables streams, wrangler checks _vt.resharding_journal on the target tablets and found a journal entry from a previous run with the same migration id. A leftover journal means a prior migration with this id did not complete cleanly, and restarting could conflict with that state. The operator must review and delete the stale journal entry before re-running.","triggerScenarios":"Re-running MoveTables with the same workflow/migration id after a previous run crashed or was partially cleaned up, leaving rows in _vt.resharding_journal on the source tablets.","commonSituations":"Interrupted MoveTables (network failure mid-migration, vtctld crash); deleting the workflow without journal cleanup; retrying a migration with a fixed migration id in automation.","solutions":["Inspect the journal on the listed tablets: SELECT * FROM _vt.resharding_journal WHERE id=<migration_id>","Verify no workflow is actively using the migration, then DELETE the stale journal row from each listed tablet","Restart the workflow: vtctldclient Workflow --keyspace <target> moveTables --workflow <wf> start"],"exampleFix":"-- on each listed tablet\nSELECT * FROM _vt.resharding_journal;\nDELETE FROM _vt.resharding_journal WHERE id=<migration_id>;\n-- then\nvtctldclient Workflow --keyspace target moveTables --workflow mt1 start","handlingStrategy":"validation","validationCode":"-- run on source tablets before retrying the migration id\nSELECT COUNT(*) AS stale FROM _vt.resharding_journal WHERE id=<migration_id>;\n-- must be 0 before re-running MoveTables","typeGuard":null,"tryCatchPattern":"if err := mz.migrateTables(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"previous run for migration id\") {\n\t\t// stop automation, page operator to review journal entries\n\t}\n\treturn err\n}","preventionTips":["Never reuse migration ids across runs without cleanup","On failure, delete journal entries as part of rollback runbooks","Alert on any rows present in _vt.resharding_journal during idle periods"],"tags":["movetables","resharding-journal","vreplication"],"backgroundTag":"stale-journal-entry","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}