{"record":{"id":"4a7af876bb56fdea","repo":"microsoft/FASTER","slug":"invalid-checksum-for-checkpoint","errorCode":null,"errorMessage":"Invalid checksum for checkpoint","messagePattern":"Invalid checksum for checkpoint","errorType":"exception","errorClass":"FasterException","httpStatus":null,"severity":"error","filePath":"cs/src/core/Index/Common/Contexts.cs","lineNumber":542,"sourceCode":"                }\n                if (sessionID > maxSessionID) maxSessionID = sessionID;\n            }\n\n            // Read object log segment offsets\n            value = reader.ReadLine();\n            var numSegments = int.Parse(value);\n            if (numSegments > 0)\n            {\n                objectLogSegmentOffsets = new long[numSegments];\n                for (int i = 0; i < numSegments; i++)\n                {\n                    value = reader.ReadLine();\n                    objectLogSegmentOffsets[i] = long.Parse(value);\n                }\n            }\n\n            if (checksum != Checksum(continueTokens.Count))\n                throw new FasterException(\"Invalid checksum for checkpoint\");\n        }\n\n        /// <summary>\n        ///  Recover info from token\n        /// </summary>\n        /// <param name=\"token\"></param>\n        /// <param name=\"checkpointManager\"></param>\n        /// <param name=\"deltaLog\"></param>\n        /// <param name = \"scanDelta\">\n        /// whether to scan the delta log to obtain the latest info contained in an incremental snapshot checkpoint.\n        /// If false, this will recover the base snapshot info but avoid potentially expensive scans.\n        /// </param>\n        /// <param name=\"recoverTo\"> specific version to recover to, if using delta log</param>\n        internal void Recover(Guid token, ICheckpointManager checkpointManager, DeltaLog deltaLog = null, bool scanDelta = false, long recoverTo = -1)\n        {\n            var metadata = checkpointManager.GetLogCheckpointMetadata(token, deltaLog, scanDelta, recoverTo);\n            if (metadata == null)\n                throw new FasterException(\"Invalid log commit metadata for ID \" + token.ToString());","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/src/core/Index/Common/Contexts.cs#L524-L560","documentation":"After reading all fields of an object-store checkpoint info file (guid, hashes, offsets, continue tokens, etc.), Recover computes a checksum over the parsed values and compares it with the checksum stored in the file. A mismatch means the checkpoint file is corrupt, truncated, or was modified after being written, so recovery is aborted with FasterException(\"Invalid checksum for checkpoint\").","triggerScenarios":"Calling Recover (object checkpoint) when the parsed checksum != Checksum(continueTokens.Count) at the end of Initialize over the checkpoint info stream.","commonSituations":"Truncated checkpoint info file from a crash during checkpoint commit; manual edits to checkpoint files; copying checkpoint files partially (e.g. missing tail lines) between machines or storage accounts.","solutions":["Restore a complete checkpoint set (info file + log/object files) from backup; do not hand-edit checkpoint files.","Verify the checkpoint commit completed (CommitInfo/commit record valid) before attempting recovery.","Re-copy the checkpoint with all files if transferring between environments.","If the latest checkpoint is unusable, recover from an earlier valid checkpoint token."],"exampleFix":"// before: recovering with a hand-copied, incomplete info file\nfaster.Recover(latestToken); // Invalid checksum for checkpoint\n\n// after: use the checkpoint manager to enumerate and validate the full checkpoint\nforeach (var cp in manager.GetCheckpointTokens())\n    try { faster.Recover(cp); break; } catch (FasterException) { /* try earlier checkpoint */ }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { faster.Recover(token); } catch (FasterException ex) when (ex.Message == \"Invalid checksum for checkpoint\") { faster.Recover(previousGoodToken); }","preventionTips":["Copy checkpoint file sets completely and atomically.","Never modify checkpoint info files manually.","Retain several checkpoint generations for fallback."],"tags":["checkpoint","checksum","recovery","corruption"],"backgroundTag":"checksum-mismatch","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}