koala73/worldmonitor · error · Error

row exceeds ${COMPANY_MONITORING_LIMITS.maxImportRowBytes} b

Error message

row exceeds ${COMPANY_MONITORING_LIMITS.maxImportRowBytes} bytes

What it means

Contract validation error from normalizeCompanyImportRow: the JSON serialization of the fully normalized row exceeds maxImportRowBytes in UTF-8 bytes. The check runs after normalization, so dedup/sorting overhead counts — the row is simply too large to persist as one import row.

Source

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

  if (!input || typeof input !== 'object') throw new Error('import row is required');
  const clientImportId = assertPlainText(
    input.clientImportId,
    'clientImportId',
    COMPANY_MONITORING_LIMITS.maxClientImportIdBytes,
  );
  if (!Number.isSafeInteger(input.ordinal) || input.ordinal < 0 || input.ordinal >= COMPANY_MONITORING_LIMITS.maxImportRows) {
    throw new Error('ordinal must be between 0 and 99');
  }

  const normalized: NormalizedCompanyImportRow = {
    contractVersion: COMPANY_MONITORING_IMPORT_VERSION,
    clientImportId,
    ordinal: input.ordinal,
    ...normalizeMonitoredCompanyInput(input),
  };

  if (utf8Bytes(JSON.stringify(normalized)) > COMPANY_MONITORING_LIMITS.maxImportRowBytes) {
    throw new Error(`row exceeds ${COMPANY_MONITORING_LIMITS.maxImportRowBytes} bytes`);
  }
  return normalized;
}

export function normalizeCompanyImportBatch(inputs: CompanyImportRowInput[]): NormalizedCompanyImportRow[] {
  if (!Array.isArray(inputs)) throw new Error('import batch must be a list');
  if (inputs.length === 0) throw new Error('import batch requires at least one row');
  if (inputs.length > COMPANY_MONITORING_LIMITS.maxImportRows) {
    throw new Error(`batch exceeds ${COMPANY_MONITORING_LIMITS.maxImportRows} rows`);
  }

  const normalized = inputs.map(normalizeCompanyImportRow).sort((left, right) => left.ordinal - right.ordinal);
  const importId = normalized[0]?.clientImportId;
  for (let index = 0; index < normalized.length; index += 1) {
    const row = normalized[index]!;
    if (row.clientImportId !== importId) throw new Error('batch rows must share one clientImportId');
    if (row.ordinal !== index) throw new Error('batch ordinals must be contiguous from 0');
  }

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Trim large text fields (aliases, identifiers, locations) from the row
  2. Split the company's data across fewer, tighter fields or raise the issue if the limit is too small for legitimate data
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shared/company-monitoring-contract.ts:302 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/63dc350de287c26a. Report an issue: GitHub.