hcengineering/platform · error · PlatformError

PersonNotFound

PersonNotFound

Error message

PersonNotFound

What it means

getPersonInfo queries db.person for a document with uuid === account; when no person document matches it throws PersonNotFound with the requested uuid in the status data. The account parameter was well-formed but no such person exists (or existed) in the database.

Source

Thrown at server/account/src/serviceOperations.ts:597

export async function getPersonInfo (
  ctx: MeasureContext,
  db: AccountDB,
  branding: Branding | null,
  token: string,
  params: { account: PersonUuid }
): Promise<PersonInfo> {
  const { account } = params
  const { extra } = decodeTokenVerbose(ctx, token)
  verifyAllowedServices(['workspace', 'tool', 'gmail', 'huly-mail', 'export'], extra)

  if (account == null || account === '') {
    throw new PlatformError(new Status(Severity.ERROR, platform.status.BadRequest, {}))
  }

  const person = await db.person.findOne({ uuid: account })

  if (person == null) {
    throw new PlatformError(new Status(Severity.ERROR, platform.status.PersonNotFound, { person: account }))
  }

  const verifiedSocialIds = await db.socialId.find({ personUuid: account, verifiedOn: { $gt: 0 } })

  return {
    personUuid: account,
    name: getPersonName(person),
    socialIds: verifiedSocialIds
  }
}

export async function addSocialIdToPerson (
  ctx: MeasureContext,
  db: AccountDB,
  branding: Branding | null,
  token: string,
  params: { person: PersonUuid, type: SocialIdType, value: string, confirmed: boolean, displayValue?: string }
): Promise<PersonId> {

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Confirm the UUID exists via the account service or a direct person collection query.
  2. Purge or resolve stale references: when you get PersonNotFound, remove the dangling member entry from your local cache/list.
  3. Verify you are querying the same environment/instance the UUID belongs to.
  4. If the person should exist, investigate whether account deletion or a migration removed them unexpectedly.

Example fix

// before
const info = await getPersonInfo(ctx, token, { account: cachedUuid })
renderProfile(info)
// after
try {
  renderProfile(await getPersonInfo(ctx, token, { account: cachedUuid }))
} catch (err) {
  if (isPlatformError(err, platform.status.PersonNotFound)) removeStaleMember(cachedUuid)
  else throw err
}
Defensive patterns

Strategy: try-catch

Validate before calling

const exists = await db.person.findOne({ uuid: account })
if (exists == null) throw new Error(`Person ${account} does not exist`)

Type guard

function personExists(p: { uuid: string } | null): p is { uuid: string } {
  return p != null && typeof p.uuid === 'string'
}

Try / catch

try {
  info = await client.getPersonInfo(ctx, token, { account })
} catch (err) {
  if (isPlatformError(err, platform.status.PersonNotFound)) {
    info = null // purge stale reference from cache/list
  } else throw err
}

Prevention

When it happens

Trigger: Looking up a person UUID that was deleted, belongs to another deployment/instance, or was synthesized locally (e.g. a placeholder UUID) rather than obtained from the account service.

Common situations: Member lists caching UUIDs of users who later deleted their accounts; cross-environment UUID reuse (staging data in prod client); integrations storing person references without handling account deletion.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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