{"record":{"id":"090d6995484455f7","repo":"overleaf/overleaf","slug":"invalid-session","errorCode":null,"errorMessage":"invalid session","messagePattern":"invalid session","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/real-time/app/js/Router.js","lineNumber":169,"sourceCode":"          if (client.connected) {\n            client.emit('reconnectGracefully')\n            client.disconnect()\n          }\n        })\n      }\n\n      if (settings.shutDownInProgress) {\n        client.emit('connectionRejected', { message: 'retry' })\n        client.disconnect()\n        return\n      }\n\n      if (\n        client &&\n        error &&\n        error.message.match(/could not look up session by key/)\n      ) {\n        logger.warn(\n          { err: error, client: !!client, session: !!session },\n          'invalid session'\n        )\n        // tell the client to reauthenticate if it has an invalid session key\n        client.emit('connectionRejected', { message: 'invalid session' })\n        client.disconnect()\n        return\n      }\n\n      if (error) {\n        logger.err(\n          { err: error, client: !!client, session: !!session },\n          'error when client connected'\n        )\n        if (client) {\n          client.emit('connectionRejected', { message: 'error' })\n        }\n        if (client) {","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/real-time/app/js/Router.js#L151-L187","documentation":"Warning logged in the socket.io connection handler when the session lookup fails with 'could not look up session by key' — the client presented an expired, revoked or unknown session key (typical after server restarts or session TTL expiry). The connection is rejected with 'invalid session' so the client re-authenticates; this is expected behavior, not a server fault.","triggerScenarios":"Thrown at services/real-time/app/js/Router.js:169 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Have the client obtain a fresh session key (re-login) and reconnect","Verify the session store (redis) is reachable and in sync across real-time instances","Check session TTL settings versus expected connection lifetimes","Ignore as routine noise unless it spikes, which indicates session-store issues"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"28ad3b03b71cb4311decdcb55c36b33ec10d72db","analyzedAt":"2026-09-03T02:10:22.807Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}