koala73/worldmonitor · error · Error

company input is required

Error message

company input is required

What it means

Contract validation error from normalizeMonitoredCompanyInput: the top-level company input is null, undefined, or not an object. It is a shape guard run before any field normalization (name, domicile, domains, handles, etc.).

Source

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

export interface NormalizedMonitoredCompanyInput {
  name: string;
  domicileCountry: 'US' | 'GB';
  aliases: string[];
  domains: string[];
  identifiers: string[];
  xHandles: string[];
  locations: string[];
  customerReference?: string;
}

export interface NormalizedCompanyImportRow extends NormalizedMonitoredCompanyInput {
  contractVersion: typeof COMPANY_MONITORING_IMPORT_VERSION;
  clientImportId: string;
  ordinal: number;
}

export function normalizeMonitoredCompanyInput(input: MonitoredCompanyInput): NormalizedMonitoredCompanyInput {
  if (!input || typeof input !== 'object') throw new Error('company input is required');
  const domicileInput = String(input.domicileCountry ?? '').trim().toUpperCase();
  const domicileCountry = Object.prototype.hasOwnProperty.call(DOMICILE_COUNTRY_BY_INPUT, domicileInput)
    ? DOMICILE_COUNTRY_BY_INPUT[domicileInput as keyof typeof DOMICILE_COUNTRY_BY_INPUT]
    : undefined;
  if (!domicileCountry) {
    throw new Error('domicileCountry must be US or GB');
  }

  const normalized: NormalizedMonitoredCompanyInput = {
    name: assertPlainText(input.name, 'name', COMPANY_MONITORING_LIMITS.maxNameBytes),
    domicileCountry,
    aliases: normalizeList(
      input.aliases,
      'aliases',
      COMPANY_MONITORING_LIMITS.maxAliases,
      (value, index) => assertPlainText(value, `aliases[${index}]`, COMPANY_MONITORING_LIMITS.maxAliasBytes),
    ),
    domains: normalizeList(input.domains, 'domains', COMPANY_MONITORING_LIMITS.maxDomains, normalizeDomain),

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Send the company as a JSON object with the documented monitoring fields
Defensive patterns

Strategy: validation

When it happens

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