koala73/worldmonitor · warning · ApiError

Please use a corporate email address.

Error message

Please use a corporate email address.

What it means

The Convex action rejected the submitted email with 422 because it is not a corporate/free-form-allowed address (the backend enforces a corporate-email policy). The handler maps it to a user-friendly 422 ApiError.

Solutions

  1. Resubmit with a corporate/business email address
  2. Show the validation message in the form UI before submission by pre-checking common free-mail domains
  3. If a legitimate corporate address is rejected, check/extend the allowed-domain list in the Convex action
  4. Use a role-based address at your company domain (e.g. sales@company.com) for testing

Example fix

// before
// client sends whatever email the user typed
await api.submitContact({ email: 'user@gmail.com', ... });
// after
const FREE_MAIL = /^[^@]+@(gmail|yahoo|hotmail|outlook)\./i;
if (FREE_MAIL.test(email)) showFormError('Please use a corporate email address.');
else await api.submitContact({ email, ... });
Defensive patterns

Strategy: validation

Validate before calling

const FREE_MAIL = /^[^@\s]+@(gmail|googlemail|yahoo|hotmail|outlook|aol|icloud|proton|mail\.)[a-z.]*$/i;
if (!/^[^@\s]+@[^@\s]+\.[a-z]{2,}$/i.test(email) || FREE_MAIL.test(email)) {
  throw new Error('Please use a corporate email address.');
}

Type guard

function isCorporateEmail(email: string): boolean {
  return /^[^@\s]+@[^@\s]+\.[a-z]{2,}$/i.test(email) && !FREE_MAIL.test(email);
}

Try / catch

try {
  await submitContact(form);
} catch (e) {
  if (e instanceof ApiError && e.status === 422) {
    setFieldError('email', 'Please use a corporate email address.');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling submitContact with an email that fails the backend's corporate-email check — e.g. gmail.com, yahoo.com, or a disposable domain.

Common situations: End users entering personal email addresses into an enterprise contact form; test fixtures using example.com or gmail.com; a disposable-domain list update newly classifying a customer's domain.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of koala73/worldmonitor@7d06c8633d (2026-09-15). Data as JSON: /api/errors/2c0993f0e70fe124. Report an issue: GitHub.

Appendix: source

Thrown at server/worldmonitor/leads/v1/submit-contact.ts:183

      },
      body: JSON.stringify({
        name: safeName,
        email: email.trim(),
        organization: safeOrg,
        phone: safePhone,
        message: safeMsg,
        source: safeSource,
      }),
      signal: AbortSignal.timeout(10_000),
    });
  } catch {
    throw new ApiError(503, 'Service unavailable', '');
  }
  if (response.status === 429) {
    throw new ApiError(429, 'Too many recent submissions for this email; try again later.', '');
  }
  if (response.status === 422) {
    throw new ApiError(422, 'Please use a corporate email address.', '');
  }
  if (!response.ok) {
    throw new ApiError(503, 'Service unavailable', '');
  }
  const result: unknown = await response.json().catch(() => null);
  if (!result || typeof result !== 'object' || !('status' in result) || result.status !== 'sent') {
    throw new ApiError(503, 'Service unavailable', '');
  }

  const emailSent = await sendNotificationEmail(
    safeName,
    email.trim(),
    safeOrg,
    safePhone,
    safeMsg,
    ip,
    country,
  );

View on GitHub (pinned to 7d06c8633d)