hcengineering/platform · info
no sessions for workspace
Error message
no sessions for workspace
What it means
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.
Source
Thrown at foundations/server/packages/server/src/sessionManager.ts:1271
compression
)
}
async closeWorkspaces (ctx: MeasureContext): Promise<void> {
clearInterval(this.checkInterval)
for (const w of this.workspaces) {
await this.doCloseAll(w[1], 1, 'shutdown')
}
await this.workspaceProducer.close()
await this.usersProducer.close()
}
private async performWorkspaceCloseCheck (workspace: Workspace): Promise<void> {
const uuid = workspace.wsId.uuid
const logParams = { uuid, url: workspace.wsId.url }
if (workspace.sessions.size === 0) {
if (LOGGING_ENABLED) {
this.ctx.warn('no sessions for workspace', logParams)
}
try {
if (workspace.sessions.size === 0) {
await workspace.close(this.ctx)
this.workspaces.delete(uuid)
workspace.context.end()
if (LOGGING_ENABLED) {
this.ctx.warn('Closed workspace', logParams)
}
await this.workspaceProducer.send(this.ctx, workspace.wsId.uuid, [workspaceEvents.down()])
}
} catch (err: any) {
Analytics.handleError(err)
this.workspaces.delete(uuid)
if (LOGGING_ENABLED) {
this.ctx.error('failed', { ...logParams, error: err })View on GitHub (pinned to 63e28dc964)
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.
Defensive patterns
Strategy: validation
Validate before calling
if (workspace.sessions.size > 0) {
// keep workspace alive; skip close check
}
Type guard
function hasSessions (ws: { sessions: Set<unknown> }): boolean {
return ws.sessions.size > 0
}
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Closed workspace
- open workspace
- Workspace closed...
- closing workspace, no users
- reconnect workspace in upgrade switch
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/5994df653ce86225.
Report an issue: GitHub.