koala73/worldmonitor · error · Error
invalid domain
Error message
invalid domain: ${domain} What it means
Contract validation error from normalizeDomain: after plain-text normalization, lowercasing, stripping a leading 'www.' and trailing dot, the domain entry does not match the DOMAIN pattern. The invalid value is echoed in the message to help locate the bad row.
Solutions
- Send a well-formed domain like 'example.com' (no scheme, path, or 'www.' prefix needed)
- Remove the trailing dot and any protocol prefix before submitting
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shared/company-monitoring-contract.ts:112 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21).
Data as JSON: /api/errors/fd5e28d1cfc5d1c1.
Report an issue: GitHub.
Appendix: source
Thrown at shared/company-monitoring-contract.ts:112
function normalizeList(
value: unknown,
field: string,
maxItems: number,
normalize: (item: unknown, index: number) => string,
): string[] {
if (value === undefined || value === null) return [];
if (!Array.isArray(value)) throw new Error(`${field} must be a list`);
if (value.length > maxItems) throw new Error(`${field} exceeds ${maxItems} items`);
return [...new Set(value.map(normalize))].sort();
}
function normalizeDomain(value: unknown, index: number): string {
const domain = assertPlainText(
value,
`domains[${index}]`,
COMPANY_MONITORING_LIMITS.maxDomainBytes,
).toLowerCase().replace(/^www\./, '').replace(/\.$/, '');
if (!DOMAIN.test(domain)) throw new Error(`invalid domain: ${domain}`);
return domain;
}
function normalizeXHandle(value: unknown, index: number): string {
const handle = assertPlainText(
value,
`xHandles[${index}]`,
COMPANY_MONITORING_LIMITS.maxXHandleInputBytes,
).replace(/^@/, '').toLowerCase();
if (!X_HANDLE.test(handle)) throw new Error(`invalid X handle: ${handle}`);
return handle;
}
const DOMICILE_COUNTRY_BY_INPUT = {
US: 'US',
GB: 'GB',
DOMICILE_COUNTRY_US: 'US',
DOMICILE_COUNTRY_GB: 'GB',View on GitHub (pinned to eeab0a219f)