{"record":{"id":"ea25c2bf2b535d9c","repo":"hcengineering/platform","slug":"open-workspace","errorCode":null,"errorMessage":"open workspace","messagePattern":"open workspace","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"foundations/server/packages/server/src/sessionManager.ts","lineNumber":642,"sourceCode":"      return {\n        resp: { upgrade: true, progress: workspaceInfo.mode === 'upgrading' ? (workspaceInfo.progress ?? 0) : 0 }\n      }\n    }\n\n    let workspace = this.workspaces.get(workspaceUuid)\n    if (workspace?.closing !== undefined) {\n      await workspace?.closing\n    }\n\n    workspace = this.workspaces.get(workspaceUuid)\n\n    const branding =\n      (workspaceInfo.branding !== undefined\n        ? Object.values(this.brandingMap).find((b) => b.key === workspaceInfo?.branding)\n        : null) ?? null\n\n    if (workspace === undefined) {\n      ctx.warn('open workspace', {\n        account: token.account,\n        workspace: workspaceUuid,\n        ...token.extra\n      })\n\n      workspace = this.createWorkspace(ctx.parent ?? ctx, ctx, token, workspaceInfo.url, workspaceInfo.dataId, branding)\n      await this.workspaceProducer.send(ctx, workspaceUuid, [workspaceEvents.open()])\n    }\n\n    if (token.extra?.model === 'upgrade') {\n      if (workspace.maintenance) {\n        ctx.warn('reconnect workspace in upgrade', {\n          account: token.account,\n          workspace: workspaceUuid,\n          wsUrl: workspaceInfo.url\n        })\n      } else {\n        ctx.warn('reconnect workspace in upgrade switch', {","sourceCodeStart":624,"sourceCodeEnd":660,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/server/packages/server/src/sessionManager.ts#L624-L660","documentation":"Informational warning logged by TSessionManager.getWorkspace when a connection arrives for a workspace that is not currently loaded in this server's this.workspaces map, so the manager creates it on demand via createWorkspace and publishes a workspaceEvents.open() event. It is a normal cold-start/cold-cache path, useful for tracking when workspaces are being instantiated and how much memory/what branding they get.","triggerScenarios":"getWorkspace called with workspaceUuid, and after awaiting any in-flight close (workspace?.closing) this.workspaces.get(workspaceUuid) still returns undefined — i.e., first connection after server start, after workspace eviction/close, or after load balancing moved the workspace to another node and back.","commonSituations":"Server restart while clients auto-reconnect; workspace was closed due to idle timeout or forceClose; rolling deploy reconnecting all clients; connection routed to a node that does not have the workspace warm.","solutions":["No action needed — this is the expected first-connect path; workspace is created and an open event is broadcast.","If it fires repeatedly for the same workspace, investigate what is closing it (idle eviction, forceClose, errors in createWorkspace) or check for load-balancer flapping between nodes.","Watch paired errors from createWorkspace / workspaceProducer.send for actual failures."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const info = await workspaceService.getWorkspaceInfo(wsUuid)\nif (info === undefined) throw new Error('Workspace not found or not available')\nif (isArchivingMode(info.mode) || isMigrationMode(info.mode) || isWorkspaceCreating(info.mode)) {\n  throw new Error(`Workspace not connectable, mode=${info.mode}`)\n}","typeGuard":"function isLoadable(ws: Workspace | undefined): ws is Workspace {\n  return ws !== undefined && ws.closing === undefined\n}","tryCatchPattern":"try {\n  const { workspace, resp } = await sessionManager.getWorkspace(ctx, wsUuid, info, token, socket)\n  if (resp?.error !== undefined) handleRespError(resp.error)\n  // workspace may be newly created — subscribe to workspaceEvents.open() for lifecycle tracking\n} catch (err) {\n  logger.error('failed to open workspace', { wsUuid, err })\n}","preventionTips":["Prefer sticky load-balancing so a workspace stays warm on one node.","Tune idle workspace eviction so active workspaces are not repeatedly re-created.","Treat this log as a cold-start metric; alert on high frequency for the same workspace.","After server restarts, rely on client auto-reconnect backoff to avoid thundering-herd workspace creation."],"tags":["workspace","cold-start","lifecycle","logging"],"backgroundTag":"workspace-cold-start","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}