{"record":{"id":"62feab4aa35272fc","repo":"microsoft/FASTER","slug":"invalid-checksum-found-during-commit-recovery","errorCode":null,"errorMessage":"Invalid checksum found during commit recovery","messagePattern":"Invalid checksum found during commit recovery","errorType":"exception","errorClass":"FasterException","httpStatus":null,"severity":"error","filePath":"cs/src/core/FasterLog/FasterLogRecoveryInfo.cs","lineNumber":141,"sourceCode":"\n                if (cookieLength >= 0)\n                {\n                    Cookie = reader.ReadBytes(cookieLength);\n                    unsafe\n                    {\n                        fixed (byte* ptr = Cookie)\n                            cookieChecksum = (long)Utility.XorBytes(ptr, cookieLength);\n                    }\n                }\n            }\n\n            long computedChecksum = BeginAddress ^ UntilAddress;\n            if (version >= FasterLogRecoveryVersion)\n                computedChecksum ^= CommitNum ^ iteratorCount ^ cookieLength ^ cookieChecksum;\n\n            // Handle case where all fields are zero\n            if (version == 0 && BeginAddress == 0 && UntilAddress == 0 && iteratorCount == 0)\n                throw new FasterException(\"Invalid checksum found during commit recovery\");\n\n            if (checkSum != computedChecksum)\n                throw new FasterException(\"Invalid checksum found during commit recovery\");\n        }\n\n        /// <summary>\n        /// Reset\n        /// </summary>\n        public void Reset()\n        {\n            Initialize();\n        }\n\n        /// <summary>\n        /// Write info to byte array\n        /// </summary>\n        public readonly byte[] ToByteArray()\n        {","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/src/core/FasterLog/FasterLogRecoveryInfo.cs#L123-L159","documentation":"During FasterLog recovery, FasterLogRecoveryInfo.Initialize computes a checksum over the commit record fields (BeginAddress ^ UntilAddress, plus CommitNum/iteratorCount/cookie fields for newer versions) and compares it with the stored checksum. This variant is thrown when the commit record is entirely zeroed (version 0 with all-zero fields), meaning no valid commit was ever persisted. It signals that recovery found an empty or uninitialized commit record rather than real checkpoint state.","triggerScenarios":"Calling FasterLog recovery (e.g. creating a FasterLog on a device whose commit record was never written) when version == 0 and BeginAddress, UntilAddress, and iteratorCount are all 0, so the zero-check guard in Initialize fires.","commonSituations":"Starting a log against a fresh/empty device or commit file; the commit metadata file was truncated or zero-filled by disk corruption or a partial format; pointing FasterLog at the wrong directory containing an empty commit file.","solutions":["If the log is expected to be new, ensure the commit metadata file does not exist or is deleted so recovery takes the fresh-log path.","Verify you are pointing FasterLog at the correct checkpoint directory / device path; a wrong path to an empty commit file is common.","Check for disk corruption or incomplete checkpoint commits; re-run checkpointing from a known-good checkpoint.","If state is unrecoverable, create a new FasterLog and re-ingest data from a backup."],"exampleFix":"// before: recovering over an empty commit file\nvar log = new FasterLog(new FasterLogSettings { LogDevice = device, CheckpointManager = manager });\n// FasterException: Invalid checksum found during commit recovery\n\n// after: validate the commit metadata exists and is non-empty before recovering\nif (!File.Exists(commitFilePath) || new FileInfo(commitFilePath).Length == 0)\n    throw new InvalidOperationException($\"No valid commit metadata at {commitFilePath}; cannot recover\");\nvar log = new FasterLog(new FasterLogSettings { LogDevice = device, CheckpointManager = manager });","handlingStrategy":"validation","validationCode":"// before recovering, ensure the commit metadata is present and non-empty\nif (!File.Exists(commitMetaPath) || new FileInfo(commitMetaPath).Length == 0)\n    throw new InvalidOperationException($\"No committed log metadata at {commitMetaPath}\");","typeGuard":null,"tryCatchPattern":"try { log = new FasterLog(settings); } catch (FasterException ex) when (ex.Message.Contains(\"Invalid checksum found during commit recovery\")) { log = new FasterLog(freshSettings); /* start new log */ }","preventionTips":["Always complete a checkpoint (WaitForCommitComplete) before shutting down.","Never point FasterLog at a directory with an empty/stale commit file.","Monitor disks for corruption; use reliable storage for checkpoint metadata."],"tags":["recovery","checksum","fasterlog","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"}