{"record":{"id":"ad751bb548e3897d","repo":"koala73/worldmonitor","slug":"field-must-be-a-list","errorCode":null,"errorMessage":"${field} must be a list","messagePattern":"(.+?) must be a list","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"shared/company-monitoring-contract.ts","lineNumber":101,"sourceCode":"  const normalized = unicodeNormalized.trim().replace(/\\s+/g, ' ');\n  if (!normalized) throw new Error(`${field} is required`);\n  if (utf8Bytes(normalized) > maxBytes) throw new Error(`${field} exceeds ${maxBytes} bytes`);\n  return normalized;\n}\n\nfunction normalizeOptionalText(value: unknown, field: string, maxBytes: number): string | undefined {\n  if (value === undefined || value === null || value === '') return undefined;\n  return assertPlainText(value, field, maxBytes);\n}\n\nfunction 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}]`,","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/shared/company-monitoring-contract.ts#L83-L119","documentation":"Contract validation error from normalizeList in the company-monitoring contract: the named field (e.g. domains, xHandles, aliases) was expected to be a JSON array but some other type was sent (undefined/null return an empty list; strings or objects hit this).","triggerScenarios":"Thrown at shared/company-monitoring-contract.ts:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send the field as a JSON array of strings","Omit it or send null to mean an empty list"],"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"}