{"record":{"id":"5994df653ce86225","repo":"hcengineering/platform","slug":"no-sessions-for-workspace","errorCode":null,"errorMessage":"no sessions for workspace","messagePattern":"no sessions for workspace","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"foundations/server/packages/server/src/sessionManager.ts","lineNumber":1271,"sourceCode":"      compression\n    )\n  }\n\n  async closeWorkspaces (ctx: MeasureContext): Promise<void> {\n    clearInterval(this.checkInterval)\n    for (const w of this.workspaces) {\n      await this.doCloseAll(w[1], 1, 'shutdown')\n    }\n    await this.workspaceProducer.close()\n    await this.usersProducer.close()\n  }\n\n  private async performWorkspaceCloseCheck (workspace: Workspace): Promise<void> {\n    const uuid = workspace.wsId.uuid\n    const logParams = { uuid, url: workspace.wsId.url }\n    if (workspace.sessions.size === 0) {\n      if (LOGGING_ENABLED) {\n        this.ctx.warn('no sessions for workspace', logParams)\n      }\n      try {\n        if (workspace.sessions.size === 0) {\n          await workspace.close(this.ctx)\n\n          this.workspaces.delete(uuid)\n          workspace.context.end()\n          if (LOGGING_ENABLED) {\n            this.ctx.warn('Closed workspace', logParams)\n          }\n\n          await this.workspaceProducer.send(this.ctx, workspace.wsId.uuid, [workspaceEvents.down()])\n        }\n      } catch (err: any) {\n        Analytics.handleError(err)\n        this.workspaces.delete(uuid)\n        if (LOGGING_ENABLED) {\n          this.ctx.error('failed', { ...logParams, error: err })","sourceCodeStart":1253,"sourceCodeEnd":1289,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/server/packages/server/src/sessionManager.ts#L1253-L1289","documentation":"TSessionManager logs 'no sessions for workspace' during performWorkspaceCloseCheck when a tracked workspace's session set has dropped to zero. It is the first step of the automatic idle-workspace teardown: if no sessions remain, the manager closes the workspace, removes it from the workspaces map, and emits a workspace 'down' event. It is a diagnostic warning, not a failure - it tells you why a workspace is being shut down.","triggerScenarios":"The periodic/deferred close check runs for a workspace after its last client session has disconnected or been removed, so workspace.sessions.size === 0 when performWorkspaceCloseCheck executes.","commonSituations":"Users closing all browser tabs attached to a workspace; sessions dropped due to network loss; session cleanup after client disconnect; normal workspace idle shutdown observed in server logs while investigating why a workspace went down.","solutions":["No fix required if shutdown is expected - this is informational logging at warn level.","If the workspace should stay alive, ensure at least one session remains connected (keep the client attached) before the close check runs.","If the workspace is closing unexpectedly, check session disconnect/timeout logic that removes sessions from workspace.sessions.","Inspect workspaceProducer.send(workspaceEvents.down()) consumers to confirm they handle workspace down events."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (workspace.sessions.size > 0) {\n  // keep workspace alive; skip close check\n}\n","typeGuard":"function hasSessions (ws: { sessions: Set<unknown> }): boolean {\n  return ws.sessions.size > 0\n}\n","tryCatchPattern":null,"preventionTips":["Keep at least one session attached if the workspace must stay up.","Treat the log as informational; alert on repeated unexpected occurrences instead.","Monitor workspace down events from workspaceProducer to correlate client disconnects."],"tags":["workspace","lifecycle","session-management","logging"],"backgroundTag":"workspace-closed-no-sessions","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}