{"record":{"id":"0d6c893c82864acd","repo":"hcengineering/platform","slug":"social-id-not-found-for-email-email","errorCode":null,"errorMessage":"Social ID not found for email: ${email}","messagePattern":"Social ID not found for email: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/importer/src/huly/huly.ts","lineNumber":540,"sourceCode":"    if (person === undefined) {\n      throw new Error(`Person not found: ${name}`)\n    }\n    return person\n  }\n\n  private async getPersonIdByEmail (email: string): Promise<PersonId> {\n    const personId = this.personIdByEmail.get(email)\n    if (personId !== undefined) {\n      return personId\n    }\n\n    const socialId = await this.client.findOne(contact.class.SocialIdentity, {\n      type: SocialIdType.EMAIL,\n      value: email\n    })\n\n    if (socialId === undefined) {\n      throw new Error(`Social ID not found for email: ${email}`)\n    }\n\n    this.personIdByEmail.set(email, socialId._id)\n\n    return socialId._id\n  }\n\n  private findAccountByName (name: string): AccountUuid {\n    const account = this.accountsByName.get(name)\n    if (account === undefined) {\n      throw new Error(`Account not found: ${name}`)\n    }\n    return account\n  }\n\n  private findEmployeeByName (name: string): Ref<Employee> {\n    const employee = this.employeesByName.get(name)\n    if (employee === undefined) {","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/huly/huly.ts#L522-L558","documentation":"getPersonIdByEmail looks up a SocialIdentity of type EMAIL in the target workspace via client.findOne to map an email to a person ID. If no social identity with that email exists, the importer cannot attribute the content to a user and throws. Results are cached per email, so this runs at most once per address.","triggerScenarios":"processComments resolves a comment author's email and calls client.findOne(contact.class.SocialIdentity, {type: EMAIL, value: email}); the query returns undefined because no account in the target workspace has a verified social identity with that exact email address.","commonSituations":"Comment authors from the source workspace do not exist in the target workspace; the user signed up with a different email; the email is stored under a different SocialIdType or is unverified; casing/whitespace differences in the email string.","solutions":["Create or invite the missing user in the target workspace using that exact email address and verify the email social identity","Correct the author email in the exported content to match an existing account","Check for casing/whitespace mismatches in the email","Re-export after user accounts in the target workspace are set up"],"exampleFix":"// missing user: dev@example.com\n// fix: invite dev@example.com to the target workspace (or update the export's author email to an existing user)\nauthorEmail: dev@example.com  // -> existing@company.com","handlingStrategy":"try-catch","validationCode":"// verify emails exist as social identities before importing comments\nfor (const email of commentAuthorEmails) {\n  const found = await client.findOne(contact.class.SocialIdentity, { type: SocialIdType.EMAIL, value: email })\n  if (found === undefined) console.warn(`No social identity for ${email}`)\n}","typeGuard":null,"tryCatchPattern":"try {\n  await importer.workspaceData(folder)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Social ID not found for email:')) {\n    const email = e.message.replace('Social ID not found for email:', '').trim()\n    console.error(`Invite ${email} to the target workspace (or fix the email in the export) and retry`)\n  } else throw e\n}","preventionTips":["Provision all comment authors in the target workspace with their exact source emails before import","Ensure emails are verified so SocialIdentity records exist","Normalize email casing/whitespace in the export","Use consistent sign-up emails across source and target workspaces"],"tags":["importer","email-lookup","social-identity"],"backgroundTag":"referenced-user-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}