{"record":{"id":"a4a955a8af19717b","repo":"hcengineering/platform","slug":"global-person-not-found-for-social-id-socialid","errorCode":null,"errorMessage":"Global person not found for social-id ${socialId}","messagePattern":"Global person not found for social-id (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/notification/pod-events-processor/src/client.ts","lineNumber":55,"sourceCode":"  socialId?: PersonId,\n  serviceTag: string = config.ServiceId\n): Promise<ClientBundle> {\n  const cached = getCachedClient(workspaceUuid, socialId, serviceTag)\n  if (cached !== undefined) return cached\n\n  const cacheKey = getCacheKey(workspaceUuid, socialId, serviceTag)\n  const inFlight = getInFlightClientCreation(cacheKey)\n  if (inFlight !== undefined) return await inFlight\n\n  const creation = (async () => {\n    const token = generateToken(systemAccountUuid, workspaceUuid, { service: serviceTag })\n    let accountClient = getAccountClient(config.AccountsUrl, token)\n\n    // If we want the notification author to be a specific user, we can obtain a workspace token for that person.\n    if (socialId !== undefined && socialId !== core.account.System) {\n      const personUuid = await accountClient.findPersonBySocialId(socialId, true)\n      if (personUuid === undefined) {\n        throw new Error(`Global person not found for social-id ${socialId}`)\n      }\n      const token = generateToken(personUuid, workspaceUuid, { service: serviceTag })\n      accountClient = getAccountClient(config.AccountsUrl, token)\n    }\n\n    const wsInfo = await accountClient.getLoginInfoByToken()\n    if (wsInfo == null || !('endpoint' in wsInfo)) {\n      throw new Error('Invalid login info')\n    }\n    const transactorUrl = wsInfo.endpoint.replace('ws://', 'http://').replace('wss://', 'https://')\n    const client = await createRestTxOperations(transactorUrl, wsInfo.workspace, wsInfo.token)\n    const bundle = { client, accountClient }\n    setCachedClient(workspaceUuid, socialId, serviceTag, bundle)\n    return bundle\n  })()\n\n  setInFlightClientCreation(cacheKey, creation)\n  try {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/notification/pod-events-processor/src/client.ts#L37-L73","documentation":"getClient in pod-events-processor builds an account client for the notification author. When a socialId is given (and is not System), it calls findPersonBySocialId on the account service; undefined means no global person exists for that social identity, so it throws 'Global person not found for social-id <id>'. This reports exactly which social id failed, unlike the mail variant of the same check.","triggerScenarios":"An event/notification carries an author socialId that the account service cannot resolve: unregistered sender, deleted account, or malformed socialId (wrong platform/prefix) passed into getClient via bundle.","commonSituations":"Processing queued events created before the author's account was deleted; social id format drift between services; cross-region account replication lag; upstream service passing its own user id instead of a platform social id.","solutions":["Log and verify the failing socialId against the account service (findPersonBySocialId) to see if it exists at all","Correct the socialId format/platform prefix at the producing service","Re-register the author account or skip the notification for deleted users","Fall back to the System account when the author cannot be resolved"],"exampleFix":"// before\nconst client = await getClient(ctx, socialId, workspaceUuid)\n// after\nconst client = await getClient(ctx, socialId, workspaceUuid).catch(() => getClient(ctx, core.account.System, workspaceUuid))","handlingStrategy":"try-catch","validationCode":"const uuid = await accountClient.findPersonBySocialId(socialId, true)\nif (uuid === undefined) {\n  console.warn(`socialId ${socialId} unresolvable; will use system account`)\n}","typeGuard":"async function isKnownSocialId(accountClient: AccountClient, socialId: string): Promise<boolean> {\n  return (await accountClient.findPersonBySocialId(socialId, true)) !== undefined\n}","tryCatchPattern":"try {\n  client = await getClient(ctx, socialId, workspaceUuid)\n} catch (e) {\n  if (e.message.startsWith('Global person not found for social-id')) {\n    client = await getClient(ctx, core.account.System, workspaceUuid)\n  } else throw e\n}","preventionTips":["Log the socialId (already in the message) and check account DB before retrying","Normalize socialId format at the producing service","Skip notifications for deleted accounts instead of failing the whole batch","Fall back to system identity for unresolvable authors"],"tags":["identity","account","notification","lookup"],"backgroundTag":"person-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}