{"record":{"id":"2ecbb41022789aa5","repo":"microsoft/FASTER","slug":"requested-commit-num-is-not-available","errorCode":null,"errorMessage":"requested commit num is not available","messagePattern":"requested commit num is not available","errorType":"exception","errorClass":"FasterException","httpStatus":null,"severity":"error","filePath":"cs/src/core/FasterLog/FasterLog.cs","lineNumber":2377,"sourceCode":"                if (metadataCommit > requestedCommitNum) continue;\n                try\n                {\n                    if (LoadCommitMetadata(metadataCommit, out info))\n                    {\n                        scanStart = metadataCommit;\n                        break;\n                    }\n                }\n                catch { }\n            }\n\n            // Need to potentially scan log for the entry \n            if (scanStart < requestedCommitNum)\n            {\n                // If not in fast commit mode, do not scan log\n                if (!fastCommitMode)\n                    // In the case where precisely requested commit num is not available, can just throw exception\n                    throw new FasterException(\"requested commit num is not available\");\n\n                // If no exact metadata is found, scan forward to see if we able to find a commit entry\n                // Shut up safe guards, I know what I am doing\n                CommittedUntilAddress = long.MaxValue;\n                beginAddress = info.BeginAddress;\n                allocator.HeadAddress = long.MaxValue;\n                try\n                {\n                    using var scanIterator = Scan(info.UntilAddress, long.MaxValue, recover: false);\n                    if (!scanIterator.ScanForwardForCommit(ref info, requestedCommitNum))\n                        throw new FasterException(\"requested commit num is not available\");\n                }\n                catch { }\n            }\n\n            // At this point, we should have found the exact commit num requested\n            Debug.Assert(info.CommitNum == requestedCommitNum);\n            if (!readOnlyMode)","sourceCodeStart":2359,"sourceCodeEnd":2395,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/src/core/FasterLog/FasterLog.cs#L2359-L2395","documentation":"When reading back at a specific commit number (e.g. via ReadAsync with a commitNum), the log may need to scan its records to find that commit's metadata. If the requested commit lies in a region already scanned but not found and fast commit mode is disabled, FasterLog cannot guarantee exact commit-number addressing and throws at FasterLog.cs:2377.","triggerScenarios":"Calling commit-number-based ReadAsync where the requested commit num's metadata is not directly available and FasterLogSettings.FastCommitMode is false (the default), so the log refuses to scan for it.","commonSituations":"Developers enable per-commit reads assuming exact commit addressing, but run with default settings where commit metadata lookup is approximate; also occurs when requesting a commit num that was never committed or was truncated from the log.","solutions":["Enable FasterLogSettings.FastCommitMode = true so the log can scan forward for exact commit entries.","Pass a commit num that is <= the latest committed commit num and still within the log's valid range (not truncated).","Use an address-based ReadAsync instead of commit-number-based reading if exact commit metadata is unavailable."],"exampleFix":"// before\nvar log = new FasterLog(new FasterLogSettings { LogDevice = device }); // FastCommitMode default false\nvar (result, _, commitNum) = await log.ReadAsync(address, readAtAddress: false, commitNum: 42);\n// after\nvar log = new FasterLog(new FasterLogSettings { LogDevice = device, FastCommitMode = true });\nvar (result, _, commitNum) = await log.ReadAsync(address, readAtAddress: false, commitNum: 42);","handlingStrategy":"validation","validationCode":"// before commit-num based read\nif (requestedCommitNum > log.GetCommitNum() || requestedCommitNum < 0)\n    throw new ArgumentOutOfRangeException(nameof(requestedCommitNum));","typeGuard":null,"tryCatchPattern":"try { await log.ReadAsync(addr, readAtAddress: false, commitNum: n); } catch (FasterException ex) when (ex.Message.Contains(\"requested commit num is not available\")) { // clamp commit num or fall back to address-based read\n}","preventionTips":["Enable FastCommitMode if exact commit-number reads are required.","Track the latest committed commit num in consumer checkpoints and clamp requests to it.","Prefer address-based reads unless exact commit semantics are needed."],"tags":["fasterlog","commit","configuration","csharp"],"backgroundTag":"resource-not-found","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"}