hcengineering/platform · info

Workspace closed...

Error message

Workspace closed...

What it means

Warning logged at the end of doCloseAll (guarded by LOGGING_ENABLED) after workspace.close(this.ctx) completed, for every close reason except 'upgrade' (where the workspace object stays alive for the upgrade handoff). It confirms the workspace was fully closed and its resources released on this node.

Source

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

    }

    if (LOGGING_ENABLED) {
      this.ctx.warn('Clients disconnected. Closing Workspace...', {
        url: workspace.wsId.url,
        uuid: workspace.wsId.uuid
      })
    }

    sessions
      .filter((it) => it[1].socket.id !== ignoreSocket?.id)
      .forEach((s) => {
        closeS(s[1].session, s[1].socket)
      })

    if (reason !== 'upgrade') {
      await workspace.close(this.ctx)
      if (LOGGING_ENABLED) {
        this.ctx.warn('Workspace closed...', { uuid: workspace.wsId.uuid, url: workspace.wsId.url })
      }
    }
  }

  private sendUpgrade (ctx: MeasureContext, webSocket: ConnectionSocket, binary: boolean, compression: boolean): void {
    void webSocket.send(
      ctx,
      {
        result: {
          _class: core.class.TxModelUpgrade
        }
      },
      binary,
      compression
    )
  }

  async closeWorkspaces (ctx: MeasureContext): Promise<void> {

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Expected terminal log — no action needed when it follows a deliberate shutdown or force-close.
  2. If it appears without an operator action, check for automated force-close or shutdown triggers and the callers of doCloseAll.
  3. If the preceding workspace.close() threw, the log is skipped — investigate close errors rather than this entry.
Defensive patterns

Strategy: validation

Validate before calling

const closed = await sessionManager.forceClose(wsId)
const stillOpen = sessionManager.workspaces.get(wsId)
if (stillOpen !== undefined) console.error('workspace not fully closed', { wsId })

Type guard

function isClosed(ws: Workspace | undefined): boolean {
  return ws === undefined || ws.closing !== undefined
}

Try / catch

try {
  await sessionManager.forceClose(wsId)
} catch (err) {
  logger.error('workspace close failed before completion', { wsId, err })
}

Prevention

When it happens

Trigger: doCloseAll finished with reason !== 'upgrade' ('shutdown' or 'force-close'), workspace.close() resolved successfully, and LOGGING_ENABLED is true. Not emitted for upgrade closes because the workspace persists through the model upgrade.

Common situations: Node shutdown finalizing workspace teardown; force-close completing on a stuck workspace; monitoring confirming workspace lifecycle completion.

Related errors


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