koala73/worldmonitor · error · Error

domicileCountry must be US or GB

Error message

domicileCountry must be US or GB

What it means

Contract validation error from normalizeMonitoredCompanyInput: after uppercasing and trimming, domicileCountry is not one of the supported values. Monitoring is currently restricted to US and GB domiciles; the own-property lookup also rejects inherited junk values.

Source

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

  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),
    identifiers: normalizeList(
      input.identifiers,
      'identifiers',
      COMPANY_MONITORING_LIMITS.maxIdentifiers,
      (value, index) => assertPlainText(value, `identifiers[${index}]`, COMPANY_MONITORING_LIMITS.maxIdentifierBytes),
    ),

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Send domicileCountry as 'US' or 'GB' (any casing is normalized)
  2. Wait for domicile support expansion if you need another country
Defensive patterns

Strategy: validation

When it happens

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