koala73/worldmonitor · error · Error

import row is required

Error message

import row is required

What it means

Contract validation error from normalizeCompanyImportRow: the CSV/import row is null, undefined, or not an object. It is the top-level shape guard before clientImportId, ordinal, and company fields are validated.

Source

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

    locations: normalizeList(
      input.locations,
      'locations',
      COMPANY_MONITORING_LIMITS.maxLocations,
      (value, index) => assertPlainText(value, `locations[${index}]`, COMPANY_MONITORING_LIMITS.maxLocationBytes),
    ),
  };

  const customerReference = normalizeOptionalText(
    input.customerReference,
    'customerReference',
    COMPANY_MONITORING_LIMITS.maxCustomerReferenceBytes,
  );
  if (customerReference !== undefined) normalized.customerReference = customerReference;
  return normalized;
}

export function normalizeCompanyImportRow(input: CompanyImportRowInput): NormalizedCompanyImportRow {
  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`);

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Send each import row as a JSON object containing clientImportId, ordinal, and the company fields
Defensive patterns

Strategy: validation

When it happens

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