hcengineering/platform · info

open workspace

Error message

open workspace

What it means

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.

Source

Thrown at foundations/server/packages/server/src/sessionManager.ts:642

      return {
        resp: { upgrade: true, progress: workspaceInfo.mode === 'upgrading' ? (workspaceInfo.progress ?? 0) : 0 }
      }
    }

    let workspace = this.workspaces.get(workspaceUuid)
    if (workspace?.closing !== undefined) {
      await workspace?.closing
    }

    workspace = this.workspaces.get(workspaceUuid)

    const branding =
      (workspaceInfo.branding !== undefined
        ? Object.values(this.brandingMap).find((b) => b.key === workspaceInfo?.branding)
        : null) ?? null

    if (workspace === undefined) {
      ctx.warn('open workspace', {
        account: token.account,
        workspace: workspaceUuid,
        ...token.extra
      })

      workspace = this.createWorkspace(ctx.parent ?? ctx, ctx, token, workspaceInfo.url, workspaceInfo.dataId, branding)
      await this.workspaceProducer.send(ctx, workspaceUuid, [workspaceEvents.open()])
    }

    if (token.extra?.model === 'upgrade') {
      if (workspace.maintenance) {
        ctx.warn('reconnect workspace in upgrade', {
          account: token.account,
          workspace: workspaceUuid,
          wsUrl: workspaceInfo.url
        })
      } else {
        ctx.warn('reconnect workspace in upgrade switch', {

View on GitHub (pinned to 63e28dc964)

Solutions

  1. No action needed — this is the expected first-connect path; workspace is created and an open event is broadcast.
  2. 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.
  3. Watch paired errors from createWorkspace / workspaceProducer.send for actual failures.
Defensive patterns

Strategy: validation

Validate before calling

const info = await workspaceService.getWorkspaceInfo(wsUuid)
if (info === undefined) throw new Error('Workspace not found or not available')
if (isArchivingMode(info.mode) || isMigrationMode(info.mode) || isWorkspaceCreating(info.mode)) {
  throw new Error(`Workspace not connectable, mode=${info.mode}`)
}

Type guard

function isLoadable(ws: Workspace | undefined): ws is Workspace {
  return ws !== undefined && ws.closing === undefined
}

Try / catch

try {
  const { workspace, resp } = await sessionManager.getWorkspace(ctx, wsUuid, info, token, socket)
  if (resp?.error !== undefined) handleRespError(resp.error)
  // workspace may be newly created — subscribe to workspaceEvents.open() for lifecycle tracking
} catch (err) {
  logger.error('failed to open workspace', { wsUuid, err })
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/ea25c2bf2b535d9c. Report an issue: GitHub.