koala73/worldmonitor · error · Error

${field} exceeds ${maxItems} items

Error message

${field} exceeds ${maxItems} items

What it means

Contract validation error from normalizeList: the array sent for the named field has more items than the per-field cap (maxItems, e.g. maxDomains, maxXHandles). Lists are also deduplicated and sorted, so only unique items count toward the work but the pre-dedup length is what triggers this.

Source

Thrown at shared/company-monitoring-contract.ts:102

  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}]`,
    COMPANY_MONITORING_LIMITS.maxXHandleInputBytes,

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Reduce the list to at most the documented maximum number of items
  2. Remove duplicates before submitting
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shared/company-monitoring-contract.ts:102 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/0d4ced31413b7bde. Report an issue: GitHub.