hcengineering/platform · error
Current workspace not found
Error message
Current workspace not found
What it means
getTokenRoomName builds the room name as `${workspaceUuid}_${room.name}_${room._id}` using the WorkspaceUuid client metadata (presentation.metadata.WorkspaceUuid). If that metadata is undefined the client cannot namespace the room to a workspace, so it throws before constructing the name. This guard prevents tokens/rooms from being created without a workspace scope.
Source
Thrown at plugins/love-resources/src/loveClient.ts:105
if (myPerson == null) {
throw new Error('Cannot find current person')
}
const platformToken = getPlatformToken()
const res = await fetch(concatLink(endpoint, '/getToken'), {
method: 'POST',
headers: {
Authorization: `Bearer ${platformToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ roomName: sessionName, _id: myPerson._id, participantName: myPerson.name })
})
return await res.text()
}
private getTokenRoomName (room: Room): string {
const currentWorkspaceUuid = getMetadata(presentation.metadata.WorkspaceUuid)
if (currentWorkspaceUuid === undefined) {
throw new Error('Current workspace not found')
}
return `${currentWorkspaceUuid}_${room.name}_${room._id}`
}
}
View on GitHub (pinned to 63e28dc964)
Solutions
- Ensure the workspace is fully initialized (workspace UUID set in presentation metadata) before creating the LoveClient or joining rooms.
- Reload the client so workspace metadata is re-fetched after login/workspace selection.
- Check the deployment/bootstrap config to confirm the workspace UUID is published to the client.
- Defer love-room operations behind a check: only call room APIs once getMetadata(presentation.metadata.WorkspaceUuid) is defined.
Example fix
// before
const name = client.getRoomToken(room) // throws 'Current workspace not found'
// after
const wsUuid = getMetadata(presentation.metadata.WorkspaceUuid)
if (wsUuid === undefined) {
console.warn('Workspace not ready; postponing room join')
} else {
const token = await client.getRoomToken(room)
} Defensive patterns
Strategy: validation
Validate before calling
const wsUuid = getMetadata(presentation.metadata.WorkspaceUuid)
if (wsUuid === undefined) {
console.warn('Workspace metadata not ready; deferring room join')
return
} Type guard
function hasWorkspace (uuid: string | undefined): uuid is string {
return typeof uuid === 'string' && uuid.length > 0
} Try / catch
try {
const token = await client.getRoomToken(room)
} catch (err) {
if (err.message === 'Current workspace not found') {
console.warn('Workspace not initialized; cannot join room yet')
return null
}
throw err
} Prevention
- Initialize the LoveClient only after workspace selection/bootstrap completes.
- Check presentation.metadata.WorkspaceUuid before any room-name operation.
- Avoid constructing love rooms in contexts without workspace metadata (e.g. pre-login screens).
- Add an init-order test that exercises room join right after workspace load.
When it happens
Trigger: Any path that needs a room name (roomName getter or refreshRoomToken's sessionName) runs while presentation.metadata.WorkspaceUuid is undefined — workspace metadata not yet loaded or never set.
Common situations: Client initialized before workspace selection/bootstrap completed; embedded usage where workspace metadata is not injected; misconfigured deployment where the workspace UUID is missing from the presentation config; race where love client is constructed before workspace metadata arrives.
Related errors
- Workspace ${options.workspace} not found
- Love service endpoint not found
- Accounts URL or token is not defined
- Sign service endpoint url is not configured
- Accounts URL or token is not defined
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/7f162a3ca9ab4570.
Report an issue: GitHub.