{"record":{"id":"9390f2666de18f32","repo":"koala73/worldmonitor","slug":"company-input-is-required","errorCode":null,"errorMessage":"company input is required","messagePattern":"company input is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"shared/company-monitoring-contract.ts","lineNumber":240,"sourceCode":"export interface NormalizedMonitoredCompanyInput {\n  name: string;\n  domicileCountry: 'US' | 'GB';\n  aliases: string[];\n  domains: string[];\n  identifiers: string[];\n  xHandles: string[];\n  locations: string[];\n  customerReference?: string;\n}\n\nexport interface NormalizedCompanyImportRow extends NormalizedMonitoredCompanyInput {\n  contractVersion: typeof COMPANY_MONITORING_IMPORT_VERSION;\n  clientImportId: string;\n  ordinal: number;\n}\n\nexport function normalizeMonitoredCompanyInput(input: MonitoredCompanyInput): NormalizedMonitoredCompanyInput {\n  if (!input || typeof input !== 'object') throw new Error('company input is required');\n  const domicileInput = String(input.domicileCountry ?? '').trim().toUpperCase();\n  const domicileCountry = Object.prototype.hasOwnProperty.call(DOMICILE_COUNTRY_BY_INPUT, domicileInput)\n    ? DOMICILE_COUNTRY_BY_INPUT[domicileInput as keyof typeof DOMICILE_COUNTRY_BY_INPUT]\n    : undefined;\n  if (!domicileCountry) {\n    throw new Error('domicileCountry must be US or GB');\n  }\n\n  const normalized: NormalizedMonitoredCompanyInput = {\n    name: assertPlainText(input.name, 'name', COMPANY_MONITORING_LIMITS.maxNameBytes),\n    domicileCountry,\n    aliases: normalizeList(\n      input.aliases,\n      'aliases',\n      COMPANY_MONITORING_LIMITS.maxAliases,\n      (value, index) => assertPlainText(value, `aliases[${index}]`, COMPANY_MONITORING_LIMITS.maxAliasBytes),\n    ),\n    domains: normalizeList(input.domains, 'domains', COMPANY_MONITORING_LIMITS.maxDomains, normalizeDomain),","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/shared/company-monitoring-contract.ts#L222-L258","documentation":"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.).","triggerScenarios":"Thrown at shared/company-monitoring-contract.ts:240 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send the company as a JSON object with the documented monitoring fields"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eeab0a219fce0f02a00603b532dbae9041b934ac","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}