stablyai/orca · error · Error

invalid_orca_org_member_email

Error message

invalid_orca_org_member_email

What it means

Thrown by orgEmailFromUnknown() when the email field of an invite or invite-revoke payload is missing, not a string, or trims to empty. Email format is not validated here — only presence of a non-whitespace string is enforced; format validation and downstream existence checks happen in the cloud org-members service.

Source

Thrown at src/main/ipc/orca-profile-org-members-handlers.ts:43

  const record = args as Record<string, unknown>
  const orgId = typeof record.orgId === 'string' ? record.orgId.trim() : ''
  if (!orgId) {
    throw new Error('invalid_orca_profile_org_selection')
  }
  return { orgId, record }
}

function orgRoleFromUnknown(value: unknown): OrcaOrgRole {
  if (value === 'owner' || value === 'admin' || value === 'member') {
    return value
  }
  throw new Error('invalid_orca_org_role')
}

function orgEmailFromUnknown(value: unknown): string {
  const email = typeof value === 'string' ? value.trim() : ''
  if (!email) {
    throw new Error('invalid_orca_org_member_email')
  }
  return email
}

function orgUserIdFromUnknown(value: unknown): string {
  const userId = typeof value === 'string' ? value.trim() : ''
  if (!userId) {
    throw new Error('invalid_orca_org_member_user')
  }
  return userId
}

function orgMemberInviteArgsFromUnknown(args: unknown): OrcaProfileOrgMemberInviteArgs {
  const { orgId, record } = orgMembersScopedArgs(args)
  return { orgId, email: orgEmailFromUnknown(record.email), role: orgRoleFromUnknown(record.role) }
}

function orgInviteRevokeArgsFromUnknown(args: unknown): OrcaProfileOrgInviteRevokeArgs {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Require a non-empty email in the renderer form before enabling submit (disable the button until trimmed value is non-empty).
  2. Pass the selected invite's email from the existing invites list when revoking, do not re-prompt the user to type it.
  3. Trim the value in the renderer so leading/trailing whitespace never reaches main.
  4. If you intend to revoke by invite id rather than email, file a change to the IPC contract — email is currently the only key.

Example fix

// before
await ipcRenderer.invoke('orcaProfiles:orgInviteRevoke', { orgId, email: invite?.inviteeEmail })

// after
const email = invite?.inviteeEmail?.trim()
if (!email) return
await ipcRenderer.invoke('orcaProfiles:orgInviteRevoke', { orgId, email })
Defensive patterns

Strategy: validation

Validate before calling

function isNonEmptyEmail(v: unknown): v is string {
  return typeof v === 'string' && v.trim().length > 0
}

if (!isNonEmptyEmail(payload.email)) {
  setEmailError('Enter an email.')
  return
}

Type guard

function isNonEmptyString(v: unknown): v is string {
  return typeof v === 'string' && v.trim() !== ''
}

Try / catch

try {
  await ipcRenderer.invoke('orcaProfiles:orgMemberInvite', { orgId, email, role })
} catch (e) {
  if (e instanceof Error && e.message === 'invalid_orca_org_member_email') {
    setEmailError('An email is required.')
  } else throw e
}

Prevention

When it happens

Trigger: Calling orcaProfiles:orgMemberInvite or orcaProfiles:orgInviteRevoke with record.email unset, null, a number, or a whitespace-only string.

Common situations: The invite email input was left blank and the form submitted, the email field was bound to the wrong state key after a rename, or the revoke action was dispatched before the email-to-revoke was selected from a list.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/b5ceefea5ecc8212. Report an issue: GitHub.