{"record":{"id":"fd5e28d1cfc5d1c1","repo":"koala73/worldmonitor","slug":"invalid-domain-domain","errorCode":null,"errorMessage":"invalid domain: ${domain}","messagePattern":"invalid domain: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"shared/company-monitoring-contract.ts","lineNumber":112,"sourceCode":"function normalizeList(\n  value: unknown,\n  field: string,\n  maxItems: number,\n  normalize: (item: unknown, index: number) => string,\n): string[] {\n  if (value === undefined || value === null) return [];\n  if (!Array.isArray(value)) throw new Error(`${field} must be a list`);\n  if (value.length > maxItems) throw new Error(`${field} exceeds ${maxItems} items`);\n  return [...new Set(value.map(normalize))].sort();\n}\n\nfunction normalizeDomain(value: unknown, index: number): string {\n  const domain = assertPlainText(\n    value,\n    `domains[${index}]`,\n    COMPANY_MONITORING_LIMITS.maxDomainBytes,\n  ).toLowerCase().replace(/^www\\./, '').replace(/\\.$/, '');\n  if (!DOMAIN.test(domain)) throw new Error(`invalid domain: ${domain}`);\n  return domain;\n}\n\nfunction normalizeXHandle(value: unknown, index: number): string {\n  const handle = assertPlainText(\n    value,\n    `xHandles[${index}]`,\n    COMPANY_MONITORING_LIMITS.maxXHandleInputBytes,\n  ).replace(/^@/, '').toLowerCase();\n  if (!X_HANDLE.test(handle)) throw new Error(`invalid X handle: ${handle}`);\n  return handle;\n}\n\nconst DOMICILE_COUNTRY_BY_INPUT = {\n  US: 'US',\n  GB: 'GB',\n  DOMICILE_COUNTRY_US: 'US',\n  DOMICILE_COUNTRY_GB: 'GB',","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/shared/company-monitoring-contract.ts#L94-L130","documentation":"Contract validation error from normalizeDomain: after plain-text normalization, lowercasing, stripping a leading 'www.' and trailing dot, the domain entry does not match the DOMAIN pattern. The invalid value is echoed in the message to help locate the bad row.","triggerScenarios":"Thrown at shared/company-monitoring-contract.ts:112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a well-formed domain like 'example.com' (no scheme, path, or 'www.' prefix needed)","Remove the trailing dot and any protocol prefix before submitting"],"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-14T05:17:10.506Z"}