{"record":{"id":"e9cd0cc2bc6d83c5","repo":"Stirling-Tools/Stirling-PDF","slug":"email-missing-for-this-user-please-contact-suppor","errorCode":null,"errorMessage":"Email missing for this user. Please contact support for manual removal.","messagePattern":"Email missing for this user\\. Please contact support for manual removal\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/editor/src/saas/services/userManagementService.ts","lineNumber":185,"sourceCode":"    await apiClient.post(\n      `/api/v1/user/admin/changeUserEnabled/${username}`,\n      formData,\n      {\n        suppressErrorToast: true,\n      },\n    );\n  },\n\n  /**\n   * Delete a user (admin only)\n   */\n  async deleteUser(\n    user: User,\n    options?: { notifyUser?: boolean },\n  ): Promise<void> {\n    if (isSupabaseConfigured && supabase) {\n      if (!user.email) {\n        throw new Error(\n          \"Email missing for this user. Please contact support for manual removal.\",\n        );\n      }\n\n      const { error } = await supabase.functions.invoke(\"delete-user\", {\n        body: {\n          target_email: user.email,\n          notify_user: options?.notifyUser ?? true,\n        },\n      });\n\n      if (error) {\n        throw new Error(error.message || \"Supabase deletion failed\");\n      }\n      return;\n    }\n  },\n","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/frontend/editor/src/saas/services/userManagementService.ts#L167-L203","documentation":"Thrown by userManagementService.deleteUser() when the User object passed to the admin delete function has no email. The delete-user edge function requires a target_email to identify the account, so without it the request cannot be constructed. The message directs the admin to contact support for manual removal.","triggerScenarios":"An admin attempts to delete a user record whose email field is null or undefined. This can happen with anonymous-upgraded accounts that never set an email, legacy accounts from a migration that lost the email field, or data inconsistencies in the user table.","commonSituations":"User account created via anonymous auth and upgraded without email verification; database migration left some users without an email; admin panel showing a corrupted user record; test/seed data without emails.","solutions":["Validate user.email exists in the admin UI before enabling the delete action","Filter or flag emailless users in the admin user list for manual handling","Contact support or use a direct database/admin API path to remove the orphaned account","Add a data-quality check to identify and remediate users missing emails"],"exampleFix":"// before\nif (!user.email) {\n  throw new Error(\"Email missing for this user. Please contact support for manual removal.\");\n}\n\n// after (in the admin UI)\nconst canDelete = Boolean(user.email);\n<DeleteButton disabled={!canDelete} title={!canDelete ? \"This user has no email and requires manual removal\" : undefined} />","handlingStrategy":"validation","validationCode":"// Validate email exists before enabling delete in admin UI\nconst canDelete = Boolean(user.email);\n// Only enable the delete button when canDelete is true","typeGuard":"function hasEmail(user: User): user is User & { email: string } {\n  return typeof user.email === 'string' && user.email.length > 0;\n}","tryCatchPattern":"try {\n  await deleteUser(user, { notifyUser: true });\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Email missing')) {\n    setAdminError('This user has no email and requires manual removal by support.');\n  } else {\n    setAdminError(e instanceof Error ? e.message : 'Deletion failed');\n  }\n}","preventionTips":["Validate user.email exists in the admin UI before enabling the delete action","Run a data-quality audit to identify and remediate users missing emails","Filter or flag emailless users in the admin list for manual handling"],"tags":["user-management","admin","validation","supabase","saas"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}