{"record":{"id":"741a82003e08b3be","repo":"microsoft/FASTER","slug":"unable-to-find-session-named-sessionname-to-recover","errorCode":null,"errorMessage":"Unable to find session named {sessionName} to recover","messagePattern":"Unable to find session named (.+?) to recover","errorType":"exception","errorClass":"FasterException","httpStatus":null,"severity":"error","filePath":"cs/src/core/ClientSession/FASTERClientSession.cs","lineNumber":223,"sourceCode":"            return ResumeSession<Input, Output, Context, IFunctions<Key, Value, Input, Output, Context>>(functions, sessionName, out commitPoint, sessionVariableLengthStructSettings, readCopyOptions);\n        }\n\n        /// <summary>\n        /// Resume (continue) prior client session with FASTER, used during\n        /// recovery from failure.\n        /// </summary>\n        /// <param name=\"functions\">Callback functions</param>\n        /// <param name=\"sessionName\">Name of previous session to resume</param>\n        /// <param name=\"commitPoint\">Prior commit point of durability for session</param>\n        /// <param name=\"sessionVariableLengthStructSettings\">Session-specific variable-length struct settings</param>\n        /// <param name=\"readCopyOptions\"><see cref=\"ReadCopyOptions\"/> for this session; override those specified at FasterKV level, and may be overridden on individual Read operations</param>\n        /// <returns>Session instance</returns>\n        internal ClientSession<Key, Value, Input, Output, Context, Functions> ResumeSession<Input, Output, Context, Functions>(Functions functions, string sessionName, out CommitPoint commitPoint,\n                SessionVariableLengthStructSettings<Value, Input> sessionVariableLengthStructSettings = null, ReadCopyOptions readCopyOptions = default)\n            where Functions : IFunctions<Key, Value, Input, Output, Context>\n        {\n            if (_recoveredSessionNameMap == null || !_recoveredSessionNameMap.TryRemove(sessionName, out int sessionID))\n                throw new FasterException($\"Unable to find session named {sessionName} to recover\");\n\n            return InternalResumeSession<Input, Output, Context, Functions, ClientSession<Key, Value, Input, Output, Context, Functions>>(functions, sessionID, out commitPoint,\n                        ctx => new ClientSession<Key, Value, Input, Output, Context, Functions>(this, ctx, functions, sessionVariableLengthStructSettings), readCopyOptions);\n        }\n\n        /// <summary>\n        /// Resume (continue) prior client session with FASTER; used during recovery from failure.\n        /// For performance reasons this overload is not recommended if functions is value type (struct).\n        /// </summary>\n        /// <param name=\"functions\">Callback functions</param>\n        /// <param name=\"sessionID\">ID of previous session to resume</param>\n        /// <param name=\"commitPoint\">Prior commit point of durability for session</param>\n        /// <param name=\"sessionVariableLengthStructSettings\">Session-specific variable-length struct settings</param>\n        /// <param name=\"readCopyOptions\"><see cref=\"ReadCopyOptions\"/> for this session; override those specified at FasterKV level, and may be overridden on individual Read operations</param>\n        /// <returns>Session instance</returns>\n        public ClientSession<Key, Value, Input, Output, Context, IFunctions<Key, Value, Input, Output, Context>> ResumeSession<Input, Output, Context>(IFunctions<Key, Value, Input, Output, Context> functions, int sessionID,\n                out CommitPoint commitPoint, SessionVariableLengthStructSettings<Value, Input> sessionVariableLengthStructSettings = null, ReadCopyOptions readCopyOptions = default)\n        {","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/src/core/ClientSession/FASTERClientSession.cs#L205-L241","documentation":"ResumeSession looks up the given session name in the recovered-session map produced by checkpoint recovery. If the name is not present (or was already resumed via TryRemove), there is no persisted state to resume and FASTER throws.","triggerScenarios":"Calling fht.ResumeSession(functions, \"mySession\", out commitPoint) when no checkpoint recovery found a session with that name, or when the session was already resumed once (TryRemove makes it single-use).","commonSituations":"Attempting to resume sessions without first calling fht.Recover() on a reopened instance; resuming the same named session twice; typo in session name.","solutions":["Call fht.Recover() first so recovery info is loaded into _recoveredSessionNameMap, then verify the name exists.","Check that the session name matches one used in a checkpointed session; create a new session if it never existed.","Do not resume the same named session twice; each recovered name can only be resumed once.","Catch FasterException and fall back to creating a new session."],"exampleFix":"// before\nvar session = fht.ResumeSession<Functions>(functions, \"worker1\", out var cp); // may throw\n// after\nfht.Recover();\nif (fht.TryRecoverSessionCheckpoint(\"worker1\", out _))\n    var session = fht.ResumeSession<Functions>(functions, \"worker1\", out var cp);\nelse\n    var session = fht.NewSession<Functions>(functions);","handlingStrategy":"try-catch","validationCode":"fht.Recover(); // load recovery info before attempting resume","typeGuard":null,"tryCatchPattern":"try\n{\n    session = fht.ResumeSession<Functions>(functions, sessionName, out var cp);\n}\ncatch (FasterException) when (ex.Message.Contains(\"Unable to find session\"))\n{\n    session = fht.NewSession<Functions>(functions);\n}","preventionTips":["Always call Recover() on a reopened instance before resuming.","Resume each named session at most once per recovery.","Log session names at checkpoint time to verify names later."],"tags":["csharp","session-management","recovery","faster"],"backgroundTag":"record-not-found","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}