microsoft/FASTER · error · Exception

Unable to find session

Error message

Unable to find session {sessionID} to recover

What it means

After resuming a session by ID, FASTER checks the returned commit point: UntilSerialNo == -1 means InternalContinue found no durable checkpoint state for that session ID. The library then rejects the resume because there is nothing to recover.

Solutions

  1. Verify the session ID was captured from a checkpointed session and is present in the current recovery info.
  2. Resume by session name instead of numeric ID to avoid stale-ID mismatches.
  3. Fall back to NewSession if the ID no longer exists in recovery info.
  4. Avoid resuming the same session ID more than once.

Example fix

// before
var session = fht.ResumeSessionById<Functions>(functions, staleId, out var cp);
// after
try
{
    var session = fht.ResumeSessionById<Functions>(functions, staleId, out var cp);
}
catch (FasterException)
{
    var session = fht.NewSession<Functions>(functions);
}
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    session = fht.ResumeSessionById<Functions>(functions, sessionId, out var cp);
}
catch (FasterException ex) when (ex.Message.Contains("Unable to find session"))
{
    session = fht.NewSession<Functions>(functions); // fall back to fresh session
}

Prevention

When it happens

Trigger: Calling ResumeSession/ResumeSessionById with a sessionID that was never checkpointed or whose recovery info was already consumed (UntilSerialNo == -1 returned from InternalContinue).

Common situations: Resuming by stale numeric session IDs from a previous process after the checkpoint set changed; double-resume of the same session ID; recovering a store whose checkpoint predates the session.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of microsoft/FASTER@321d872eab (2026-09-15). Data as JSON: /api/errors/c1240944593572ef. Report an issue: GitHub.

Appendix: source

Thrown at cs/src/core/ClientSession/FASTERClientSession.cs:273

        internal ClientSession<Key, Value, Input, Output, Context, Functions> ResumeSession<Input, Output, Context, Functions>(Functions functions, int sessionID, out CommitPoint commitPoint,
                SessionVariableLengthStructSettings<Value, Input> sessionVariableLengthStructSettings = null, ReadCopyOptions readCopyOptions = default)
            where Functions : IFunctions<Key, Value, Input, Output, Context>
        {
            return InternalResumeSession<Input, Output, Context, Functions, ClientSession<Key, Value, Input, Output, Context, Functions>>(functions, sessionID, out commitPoint,
                        ctx => new ClientSession<Key, Value, Input, Output, Context, Functions>(this, ctx, functions, sessionVariableLengthStructSettings), readCopyOptions);
        }

        private TSession InternalResumeSession<Input, Output, Context, Functions, TSession>(Functions functions, int sessionID, out CommitPoint commitPoint,
                                                                                            Func<FasterExecutionContext<Input, Output, Context>, TSession> sessionCreator, ReadCopyOptions readCopyOptions)
             where TSession : IClientSession
        {
            if (functions == null)
                throw new ArgumentNullException(nameof(functions));

            string sessionName;
            (sessionName, commitPoint) = InternalContinue<Input, Output, Context>(sessionID, out var ctx);
            if (commitPoint.UntilSerialNo == -1)
                throw new Exception($"Unable to find session {sessionID} to recover");
            ctx.MergeReadCopyOptions(this.ReadCopyOptions, readCopyOptions);

            var session = sessionCreator(ctx);

            if (_activeSessions == null)
                Interlocked.CompareExchange(ref _activeSessions, new Dictionary<int, SessionInfo>(), null);
            lock (_activeSessions)
                _activeSessions.Add(sessionID, new SessionInfo { sessionName = sessionName, session = session, isActive = true });
            return session;
        }

        /// <summary>
        /// Dispose session with FASTER
        /// </summary>
        /// <param name="sessionID"></param>
        /// <param name="sessionPhase"></param>
        /// <returns></returns>
        internal void DisposeClientSession(int sessionID, Phase sessionPhase)

View on GitHub (pinned to 321d872eab)