koala73/worldmonitor · warning · ConvexError
Name is required
Error message
Name is required
What it means
Thrown by the contactMessages submit mutation when the name field is empty after clipping control characters and trimming whitespace. The clip helper strips C0/DEL controls and trims, so a name of only whitespace or control characters is treated as missing. This is the first validation gate before email/organization checks.
Source
Thrown at convex/contactMessages.ts:67
name: v.string(),
email: v.string(),
organization: v.optional(v.string()),
phone: v.optional(v.string()),
message: v.optional(v.string()),
source: v.string(),
},
handler: async (ctx, args) => {
// Length / shape validation. Reject obviously-bogus input before
// it reaches the table — also a defence against prompt-injection
// payloads enormous enough to trip downstream LLM cost.
const name = clip(args.name, MAX_NAME);
const email = clip(args.email, MAX_EMAIL);
const organization = clip(args.organization, MAX_ORG);
const phone = clip(args.phone, MAX_PHONE);
const message = clip(args.message, MAX_MESSAGE, { preserveNewlines: true });
const source = clip(args.source, MAX_SOURCE) ?? "unknown";
if (!name) throw new ConvexError("Name is required");
if (!email || !EMAIL_RE.test(email)) {
throw new ConvexError("Valid email is required");
}
if (!isCorporateDomain(email)) {
throw new ConvexError({
kind: "FREE_EMAIL_NOT_ALLOWED",
message: "Please use a corporate email address.",
});
}
const normalizedEmail = email.toLowerCase();
// Throttle: cap recent submissions per email. Index lookup keeps this O(matches),
// which the limit caps at PER_EMAIL_LIMIT + 1.
const windowStart = Date.now() - PER_EMAIL_WINDOW_MS;
const recent = await ctx.db
.query("contactMessages")
.withIndex("by_normalized_email_received", (q) =>View on GitHub (pinned to ffec79ac33)
Solutions
- Require a non-empty, trimmed name on the client before enabling submit.
- Strip control characters client-side and validate length >= 1 and <= MAX_NAME (500).
- Show a field-level validation error when the user blanks the name.
Example fix
// before
await submit({ name: " ", email, source });
// after
const trimmedName = name.trim();
if (!trimmedName) throw new Error("Name is required");
await submit({ name: trimmedName, email, source }); Defensive patterns
Strategy: validation
Validate before calling
const name = (args.name ?? "").trim();
if (!name) throw new Error("Name is required"); Type guard
function isNonEmptyName(value: string | undefined): boolean {
return Boolean(value && value.trim().length > 0);
} Prevention
- Validate a trimmed, non-empty name on the client before submit.
- Disable the submit button until name passes validation.
When it happens
Trigger: Calling submit with a name that is empty, only whitespace, or composed solely of control characters after cleaning; or with name undefined when the validator should have rejected it.
Common situations: Frontend not validating the name field; autofill submitting whitespace; spam bot sending control-char payloads; a form allowing submit before name input.
Related errors
- INCOMPATIBLE_DELIVERY
- COUNTRIES_LIMIT_EXCEEDED
- TICKERS_LIMIT_EXCEEDED
- digestHour must be an integer 0–23
- digestTimezone must be a valid IANA timezone (e.g. America/N
AI-assisted analysis of koala73/worldmonitor@ffec79ac33 (2026-08-12).
Data as JSON: /api/errors/70c05e58b3e7e01c.
Report an issue: GitHub.