Stirling-Tools/Stirling-PDF · error · Error

Email missing for this user. Please contact support for manu

Error message

Email missing for this user. Please contact support for manual removal.

What it means

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.

Source

Thrown at frontend/editor/src/saas/services/userManagementService.ts:185

    await apiClient.post(
      `/api/v1/user/admin/changeUserEnabled/${username}`,
      formData,
      {
        suppressErrorToast: true,
      },
    );
  },

  /**
   * Delete a user (admin only)
   */
  async deleteUser(
    user: User,
    options?: { notifyUser?: boolean },
  ): Promise<void> {
    if (isSupabaseConfigured && supabase) {
      if (!user.email) {
        throw new Error(
          "Email missing for this user. Please contact support for manual removal.",
        );
      }

      const { error } = await supabase.functions.invoke("delete-user", {
        body: {
          target_email: user.email,
          notify_user: options?.notifyUser ?? true,
        },
      });

      if (error) {
        throw new Error(error.message || "Supabase deletion failed");
      }
      return;
    }
  },

View on GitHub (pinned to 9ef20dcab8)

Solutions

  1. Validate user.email exists in the admin UI before enabling the delete action
  2. Filter or flag emailless users in the admin user list for manual handling
  3. Contact support or use a direct database/admin API path to remove the orphaned account
  4. Add a data-quality check to identify and remediate users missing emails

Example fix

// before
if (!user.email) {
  throw new Error("Email missing for this user. Please contact support for manual removal.");
}

// after (in the admin UI)
const canDelete = Boolean(user.email);
<DeleteButton disabled={!canDelete} title={!canDelete ? "This user has no email and requires manual removal" : undefined} />
Defensive patterns

Strategy: validation

Validate before calling

// Validate email exists before enabling delete in admin UI
const canDelete = Boolean(user.email);
// Only enable the delete button when canDelete is true

Type guard

function hasEmail(user: User): user is User & { email: string } {
  return typeof user.email === 'string' && user.email.length > 0;
}

Try / catch

try {
  await deleteUser(user, { notifyUser: true });
} catch (e) {
  if (e instanceof Error && e.message.includes('Email missing')) {
    setAdminError('This user has no email and requires manual removal by support.');
  } else {
    setAdminError(e instanceof Error ? e.message : 'Deletion failed');
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13). Data as JSON: /api/errors/e9cd0cc2bc6d83c5. Report an issue: GitHub.