{"record":{"id":"0d4ced31413b7bde","repo":"koala73/worldmonitor","slug":"field-exceeds-maxitems-items","errorCode":null,"errorMessage":"${field} exceeds ${maxItems} items","messagePattern":"(.+?) exceeds (.+?) items","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"shared/company-monitoring-contract.ts","lineNumber":102,"sourceCode":"  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}]`,\n    COMPANY_MONITORING_LIMITS.maxXHandleInputBytes,","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/shared/company-monitoring-contract.ts#L84-L120","documentation":"Contract validation error from normalizeList: the array sent for the named field has more items than the per-field cap (maxItems, e.g. maxDomains, maxXHandles). Lists are also deduplicated and sorted, so only unique items count toward the work but the pre-dedup length is what triggers this.","triggerScenarios":"Thrown at shared/company-monitoring-contract.ts:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the list to at most the documented maximum number of items","Remove duplicates 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-14T00:17:10.932Z"}