hcengineering/platform · error

Social ID not found for email: ${email}

Error message

Social ID not found for email: ${email}

What it means

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.

Source

Thrown at packages/importer/src/huly/huly.ts:540

    if (person === undefined) {
      throw new Error(`Person not found: ${name}`)
    }
    return person
  }

  private async getPersonIdByEmail (email: string): Promise<PersonId> {
    const personId = this.personIdByEmail.get(email)
    if (personId !== undefined) {
      return personId
    }

    const socialId = await this.client.findOne(contact.class.SocialIdentity, {
      type: SocialIdType.EMAIL,
      value: email
    })

    if (socialId === undefined) {
      throw new Error(`Social ID not found for email: ${email}`)
    }

    this.personIdByEmail.set(email, socialId._id)

    return socialId._id
  }

  private findAccountByName (name: string): AccountUuid {
    const account = this.accountsByName.get(name)
    if (account === undefined) {
      throw new Error(`Account not found: ${name}`)
    }
    return account
  }

  private findEmployeeByName (name: string): Ref<Employee> {
    const employee = this.employeesByName.get(name)
    if (employee === undefined) {

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Create or invite the missing user in the target workspace using that exact email address and verify the email social identity
  2. Correct the author email in the exported content to match an existing account
  3. Check for casing/whitespace mismatches in the email
  4. Re-export after user accounts in the target workspace are set up

Example fix

// missing user: dev@example.com
// fix: invite dev@example.com to the target workspace (or update the export's author email to an existing user)
authorEmail: dev@example.com  // -> existing@company.com
Defensive patterns

Strategy: try-catch

Validate before calling

// verify emails exist as social identities before importing comments
for (const email of commentAuthorEmails) {
  const found = await client.findOne(contact.class.SocialIdentity, { type: SocialIdType.EMAIL, value: email })
  if (found === undefined) console.warn(`No social identity for ${email}`)
}

Try / catch

try {
  await importer.workspaceData(folder)
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Social ID not found for email:')) {
    const email = e.message.replace('Social ID not found for email:', '').trim()
    console.error(`Invite ${email} to the target workspace (or fix the email in the export) and retry`)
  } else throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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