{"record":{"id":"039fb4b0a9b30c8d","repo":"hashicorp/nomad","slug":"last-index-mismatch-source-d-destination-d","errorCode":null,"errorMessage":"last index mismatch: source=%d, destination=%d","messagePattern":"last index mismatch: source=(.+?), destination=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helper/raftutil/migrate.go","lineNumber":277,"sourceCode":"\t\treturn fmt.Errorf(\"failed to get source last index: %w\", err)\n\t}\n\n\tdstFirst, err := dst.FirstIndex()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get destination first index: %w\", err)\n\t}\n\n\tdstLast, err := dst.LastIndex()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get destination last index: %w\", err)\n\t}\n\n\tif srcFirst != dstFirst {\n\t\treturn fmt.Errorf(\"first index mismatch: source=%d, destination=%d\", srcFirst, dstFirst)\n\t}\n\n\tif srcLast != dstLast {\n\t\treturn fmt.Errorf(\"last index mismatch: source=%d, destination=%d\", srcLast, dstLast)\n\t}\n\n\t// Verify stable store uint64 keys.\n\tuint64Keys := []string{\"CurrentTerm\", \"LastVoteTerm\"}\n\tfor _, key := range uint64Keys {\n\t\tsrcVal, err := src.GetUint64([]byte(key))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get source uint64 key %s: %w\", key, err)\n\t\t}\n\n\t\tdstVal, err := dst.GetUint64([]byte(key))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get destination uint64 key %s: %w\", key, err)\n\t\t}\n\n\t\tif srcVal != dstVal {\n\t\t\treturn fmt.Errorf(\"stable key %s mismatch: source=%d, destination=%d\", key, srcVal, dstVal)\n\t\t}","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/helper/raftutil/migrate.go#L259-L295","documentation":"Fires in verifyMigration when the source and destination raft logs disagree on LastIndex: the destination WAL is truncated or has extra trailing entries, so the migrated log does not cover the same range.","triggerScenarios":"Thrown at helper/raftutil/migrate.go:277 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run the migration after removing the partial WAL directory","Confirm the BoltDB source was not modified concurrently during migration","Fall back to the pre-migration backup if re-migration keeps failing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}