koala73/worldmonitor · error · Error
${field} must be a list
Error message
${field} must be a list What it means
Contract validation error from normalizeList in the company-monitoring contract: the named field (e.g. domains, xHandles, aliases) was expected to be a JSON array but some other type was sent (undefined/null return an empty list; strings or objects hit this).
Source
Thrown at shared/company-monitoring-contract.ts:101
const normalized = unicodeNormalized.trim().replace(/\s+/g, ' ');
if (!normalized) throw new Error(`${field} is required`);
if (utf8Bytes(normalized) > maxBytes) throw new Error(`${field} exceeds ${maxBytes} bytes`);
return normalized;
}
function normalizeOptionalText(value: unknown, field: string, maxBytes: number): string | undefined {
if (value === undefined || value === null || value === '') return undefined;
return assertPlainText(value, field, maxBytes);
}
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}]`,View on GitHub (pinned to eeab0a219f)
Solutions
- Send the field as a JSON array of strings
- Omit it or send null to mean an empty list
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shared/company-monitoring-contract.ts:101 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/ad751bb548e3897d.
Report an issue: GitHub.