{"record":{"id":"34f3203a79bb46c9","repo":"hcengineering/platform","slug":"platform-status-internalservererror-34f320","errorCode":"platform.status.InternalServerError","errorMessage":"InternalServerError","messagePattern":"InternalServerError","errorType":"exception","errorClass":"PlatformError","httpStatus":null,"severity":"critical","filePath":"server/account/src/operations.ts","lineNumber":1337,"sourceCode":"  const mailURL = getMetadata(accountPlugin.metadata.MAIL_URL)\n  const forceConfirmation = mailURL !== undefined && mailURL !== ''\n\n  const { account, socialId } = await signUpByEmail(\n    ctx,\n    db,\n    branding,\n    email,\n    password,\n    first,\n    last ?? '',\n    !forceConfirmation\n  )\n  void setTimezone(ctx, db, account, null, meta)\n\n  if (forceConfirmation) {\n    const person = await db.person.findOne({ uuid: account })\n    if (person == null) {\n      throw new PlatformError(new Status(Severity.ERROR, platform.status.InternalServerError, {}))\n    }\n\n    const normalizedEmail = cleanEmail(email)\n    // Thread the invite info through the confirmation token so the user\n    // is auto-joined to the workspace once they confirm their email.\n    await sendEmailConfirmation(ctx, branding, account, normalizedEmail, {\n      inviteId,\n      workspaceUrl\n    })\n\n    return {\n      account,\n      name: getPersonName(person),\n      socialId,\n      token: undefined\n    }\n  }\n","sourceCodeStart":1319,"sourceCodeEnd":1355,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/server/account/src/operations.ts#L1319-L1355","documentation":"During signup when email confirmation is forced, the server re-reads the freshly created person record via `db.person.findOne({ uuid: account })`. If the person document is missing even though the account uuid exists, the server throws InternalServerError because it cannot thread invite info into the confirmation email. This indicates an inconsistent account/person state rather than a client mistake.","triggerScenarios":"signUpJoinWorkspace / signup flow with forceConfirmation=true where the person row for the just-created account uuid is not found (replication lag, failed person creation, or person deleted between account creation and this lookup).","commonSituations":"Distributed DB (e.g. mongodb replica read from secondary) returns stale data right after account creation; a bug or migration removed person records; multi-region setup with eventual consistency; partially failed transaction during account provisioning.","solutions":["Verify the person document exists in db.person for the account uuid; restore/recreate it if missing.","Check whether account creation and person creation run in the same transaction; make person creation atomic with account creation.","If using a read-from-secondary DB config, ensure reads of the new account go to primary (read-your-writes).","Retry the signup request; if it persists, inspect server logs around account creation for failed inserts."],"exampleFix":"// before\nconst person = await db.person.findOne({ uuid: account })\nif (person == null) { throw ... }\n\n// after (retry primary read)\nlet person = await db.person.findOne({ uuid: account })\nif (person == null) person = await primaryDb.person.findOne({ uuid: account })\nif (person == null) { throw new PlatformError(new Status(Severity.ERROR, platform.status.PersonNotFound, { person: account })) }","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await signUpJoinWorkspace(ctx, params) } catch (err) { if (isStatusError(err, platform.status.InternalServerError)) { await sleep(200); retryOnce(); } else throw err }","preventionTips":["Create account and person records atomically","Use primary reads for read-your-writes after account creation","Monitor replication lag in distributed DB setups"],"tags":["data-consistency","database","server-state"],"backgroundTag":"record-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}