{"record":{"id":"b5ceefea5ecc8212","repo":"stablyai/orca","slug":"invalid-orca-org-member-email","errorCode":null,"errorMessage":"invalid_orca_org_member_email","messagePattern":"invalid_orca_org_member_email","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/orca-profile-org-members-handlers.ts","lineNumber":43,"sourceCode":"  const record = args as Record<string, unknown>\n  const orgId = typeof record.orgId === 'string' ? record.orgId.trim() : ''\n  if (!orgId) {\n    throw new Error('invalid_orca_profile_org_selection')\n  }\n  return { orgId, record }\n}\n\nfunction orgRoleFromUnknown(value: unknown): OrcaOrgRole {\n  if (value === 'owner' || value === 'admin' || value === 'member') {\n    return value\n  }\n  throw new Error('invalid_orca_org_role')\n}\n\nfunction orgEmailFromUnknown(value: unknown): string {\n  const email = typeof value === 'string' ? value.trim() : ''\n  if (!email) {\n    throw new Error('invalid_orca_org_member_email')\n  }\n  return email\n}\n\nfunction orgUserIdFromUnknown(value: unknown): string {\n  const userId = typeof value === 'string' ? value.trim() : ''\n  if (!userId) {\n    throw new Error('invalid_orca_org_member_user')\n  }\n  return userId\n}\n\nfunction orgMemberInviteArgsFromUnknown(args: unknown): OrcaProfileOrgMemberInviteArgs {\n  const { orgId, record } = orgMembersScopedArgs(args)\n  return { orgId, email: orgEmailFromUnknown(record.email), role: orgRoleFromUnknown(record.role) }\n}\n\nfunction orgInviteRevokeArgsFromUnknown(args: unknown): OrcaProfileOrgInviteRevokeArgs {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/orca-profile-org-members-handlers.ts#L25-L61","documentation":"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.","triggerScenarios":"Calling orcaProfiles:orgMemberInvite or orcaProfiles:orgInviteRevoke with record.email unset, null, a number, or a whitespace-only string.","commonSituations":"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.","solutions":["Require a non-empty email in the renderer form before enabling submit (disable the button until trimmed value is non-empty).","Pass the selected invite's email from the existing invites list when revoking, do not re-prompt the user to type it.","Trim the value in the renderer so leading/trailing whitespace never reaches main.","If you intend to revoke by invite id rather than email, file a change to the IPC contract — email is currently the only key."],"exampleFix":"// before\nawait ipcRenderer.invoke('orcaProfiles:orgInviteRevoke', { orgId, email: invite?.inviteeEmail })\n\n// after\nconst email = invite?.inviteeEmail?.trim()\nif (!email) return\nawait ipcRenderer.invoke('orcaProfiles:orgInviteRevoke', { orgId, email })","handlingStrategy":"validation","validationCode":"function isNonEmptyEmail(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0\n}\n\nif (!isNonEmptyEmail(payload.email)) {\n  setEmailError('Enter an email.')\n  return\n}","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === 'string' && v.trim() !== ''\n}","tryCatchPattern":"try {\n  await ipcRenderer.invoke('orcaProfiles:orgMemberInvite', { orgId, email, role })\n} catch (e) {\n  if (e instanceof Error && e.message === 'invalid_orca_org_member_email') {\n    setEmailError('An email is required.')\n  } else throw e\n}","preventionTips":["Disable submit until the invite email field has a trimmed non-empty value.","For revoke, pass the email from the selected invite row rather than asking the user to retype it.","Trim the email in the renderer before sending."],"tags":["ipc","validation","orca-profiles","argument-validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}