hcengineering/platform · error · PlatformError
SocialIdNotFound
SocialIdNotFound
Error message
platform.status.SocialIdNotFound
What it means
Thrown during password setup when the accountUuid has no EMAIL-type social ID attached. The account exists (it passed the hash check) but has no email identity, so no setup email can be sent and the flow cannot continue. Status carries an empty value and SocialIdType.EMAIL.
Source
Thrown at server/account/src/operations.ts:1593
// Guard: reject if the account already has a password. The setup flow
// bypasses the old-password requirement in changePassword, so it must only
// be accessible to accounts that have no password yet.
const existingAccount = await getAccount(db, accountUuid)
if (existingAccount?.hash != null && existingAccount?.salt != null) {
throw new PlatformError(new Status(Severity.ERROR, platform.status.BadRequest, {}))
}
ctx.info('Requesting password setup', { accountUuid })
const emailSocialId = await db.socialId.findOne({
type: SocialIdType.EMAIL,
personUuid: accountUuid
})
if (emailSocialId == null) {
ctx.error('Email social id not found for account', { accountUuid })
throw new PlatformError(
new Status(Severity.ERROR, platform.status.SocialIdNotFound, { value: '', type: SocialIdType.EMAIL })
)
}
const { mailURL, mailAuth } = getMailUrl()
const front = getFrontUrl(branding)
const resetToken = generateToken(accountUuid, undefined, { restoreEmail: emailSocialId.value })
const link = concatLink(front, `/login/recovery?id=${resetToken}`)
const lang = branding?.language
const text = await translate(accountPlugin.string.PasswordSetupText, { link }, lang)
const html = await translate(accountPlugin.string.PasswordSetupHTML, { link }, lang)
const subject = await translate(accountPlugin.string.PasswordSetupSubject, {}, lang)
const response = await fetch(concatLink(mailURL, '/send'), {
method: 'post',
headers: {
'Content-Type': 'application/json',
...(mailAuth != null ? { Authorization: `Bearer ${mailAuth}` } : {})View on GitHub (pinned to 63e28dc964)
Solutions
- Ensure the account has a verified EMAIL social ID before requesting password setup.
- Add the email social ID to the account (re-link email) before the setup flow.
- Fall back to the identity-provider login for non-email accounts.
- Verify db.socialId.findOne({type: SocialIdType.EMAIL, personUuid}) returns a row in your environment.
Example fix
// before: setup for any account
await accountClient.requestPasswordSetup(ctx, branding, accountUuid)
// after: ensure email identity exists
const sid = await db.socialId.findOne({ type: SocialIdType.EMAIL, personUuid: accountUuid })
if (sid == null) throw new Error('Account has no email social id; use OAuth login')
await accountClient.requestPasswordSetup(ctx, branding, accountUuid) Defensive patterns
Strategy: validation
Validate before calling
const sid = await db.socialId.findOne({ type: SocialIdType.EMAIL, personUuid: accountUuid })
if (sid == null) throw new Error('Account has no email social id') Type guard
function isEmailSocialId(s: SocialId | null): s is SocialId & { type: SocialIdType.EMAIL } { return s != null && s.type === SocialIdType.EMAIL } Try / catch
try {
await accountClient.requestPasswordSetup(ctx, branding, accountUuid)
} catch (err) {
if (err instanceof PlatformError && err.status.code === platform.status.SocialIdNotFound) {
// direct user to OAuth login or email-linking flow
} else throw err
} Prevention
- Require an email social ID at account creation, even for OAuth signups.
- Never prune socialId rows without auditing references.
- Gate password setup features behind email-identity presence.
When it happens
Trigger: requestPasswordSetup called for an account created without an email social ID (e.g. GitHub/Google-only account, or socialId row missing).
Common situations: OAuth-only signups asked to set a password; database where socialId documents were pruned; account created through a non-email signup path; mismatched SocialIdType.
Related errors
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/b28b52a848af4774.
Report an issue: GitHub.