hcengineering/platform · error
Cannot find current person
Error message
Cannot find current person
What it means
refreshRoomToken calls getPersonByPersonRef(getCurrentEmployee()) to identify the user asking for a room token. If that lookup returns null — the current employee's person record cannot be resolved — the client refuses to continue and throws, because the Love service needs a valid person identity to mint tokens. This runs after the endpoint check, so the endpoint was fine but the user identity resolution failed.
Source
Thrown at plugins/love-resources/src/loveClient.ts:88
private getLoveEndpoint (): string {
const endpoint = getMetadata(love.metadata.ServiceEnpdoint)
if (endpoint === undefined) {
throw new Error('Love service endpoint not found')
}
return endpoint
}
private async refreshRoomToken (room: Room): Promise<string> {
const sessionName = this.getTokenRoomName(room)
const endpoint = this.getLoveEndpoint()
if (endpoint === undefined) {
throw new Error('Love service endpoint not found')
}
const myPerson = await getPersonByPersonRef(getCurrentEmployee())
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')
}View on GitHub (pinned to 63e28dc964)
Solutions
- Re-login / refresh the session so getCurrentEmployee() returns a valid employee linked to a Person record.
- Verify the account has a properly linked Person record; create or repair the employee-to-person link in the database.
- Delay room-token refresh until user data is fully loaded (wait for account/person initialization before joining rooms).
- Catch the error client-side and prompt the user to reload or re-authenticate before retrying the call.
Example fix
// before
const token = await client.getRoomToken(room)
// after
try {
const token = await client.getRoomToken(room)
} catch (err) {
if (err.message === 'Cannot find current person') {
console.warn('User identity not ready; re-authenticating before joining room')
await relogin()
return await client.getRoomToken(room)
}
throw err
} Defensive patterns
Strategy: try-catch
Validate before calling
const myPerson = await getPersonByPersonRef(getCurrentEmployee())
if (myPerson == null) {
console.warn('Current person not resolvable; re-authentication needed')
return
} Type guard
function hasPerson (p: Person | null | undefined): p is Person {
return p != null
} Try / catch
try {
const token = await client.getRoomToken(room)
} catch (err) {
if (err.message === 'Cannot find current person') {
await relogin()
return await client.getRoomToken(room)
}
throw err
} Prevention
- Only join/refresh call rooms after user and person data are fully loaded.
- Re-authenticate on session expiry before making service calls.
- Ensure every employee account has a linked Person record.
- Handle guest/limited accounts explicitly instead of letting them hit token refresh.
When it happens
Trigger: getRoomToken -> refreshRoomToken while getCurrentEmployee() returns a ref that does not resolve to a Person via getPersonByPersonRef (returns null): the logged-in employee account has no linked Person record, or the employee reference is unset/stale.
Common situations: User session is stale or logged out when the call room token refresh happens; guest/limited account without a Person record joins a love room; employee data not yet synchronized after account creation; person record deleted while session persists.
Related errors
- Workspace ${options.workspace} not found
- await response.text()
- Login failed
- Workspace not found
- Workspace or account not found in token
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/88cff28548cc37c6.
Report an issue: GitHub.