{"record":{"id":"63dc350de287c26a","repo":"koala73/worldmonitor","slug":"row-exceeds-company-monitoring-limits-maximportr","errorCode":null,"errorMessage":"row exceeds ${COMPANY_MONITORING_LIMITS.maxImportRowBytes} bytes","messagePattern":"row exceeds (.+?) bytes","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"shared/company-monitoring-contract.ts","lineNumber":302,"sourceCode":"  if (!input || typeof input !== 'object') throw new Error('import row is required');\n  const clientImportId = assertPlainText(\n    input.clientImportId,\n    'clientImportId',\n    COMPANY_MONITORING_LIMITS.maxClientImportIdBytes,\n  );\n  if (!Number.isSafeInteger(input.ordinal) || input.ordinal < 0 || input.ordinal >= COMPANY_MONITORING_LIMITS.maxImportRows) {\n    throw new Error('ordinal must be between 0 and 99');\n  }\n\n  const normalized: NormalizedCompanyImportRow = {\n    contractVersion: COMPANY_MONITORING_IMPORT_VERSION,\n    clientImportId,\n    ordinal: input.ordinal,\n    ...normalizeMonitoredCompanyInput(input),\n  };\n\n  if (utf8Bytes(JSON.stringify(normalized)) > COMPANY_MONITORING_LIMITS.maxImportRowBytes) {\n    throw new Error(`row exceeds ${COMPANY_MONITORING_LIMITS.maxImportRowBytes} bytes`);\n  }\n  return normalized;\n}\n\nexport function normalizeCompanyImportBatch(inputs: CompanyImportRowInput[]): NormalizedCompanyImportRow[] {\n  if (!Array.isArray(inputs)) throw new Error('import batch must be a list');\n  if (inputs.length === 0) throw new Error('import batch requires at least one row');\n  if (inputs.length > COMPANY_MONITORING_LIMITS.maxImportRows) {\n    throw new Error(`batch exceeds ${COMPANY_MONITORING_LIMITS.maxImportRows} rows`);\n  }\n\n  const normalized = inputs.map(normalizeCompanyImportRow).sort((left, right) => left.ordinal - right.ordinal);\n  const importId = normalized[0]?.clientImportId;\n  for (let index = 0; index < normalized.length; index += 1) {\n    const row = normalized[index]!;\n    if (row.clientImportId !== importId) throw new Error('batch rows must share one clientImportId');\n    if (row.ordinal !== index) throw new Error('batch ordinals must be contiguous from 0');\n  }","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/shared/company-monitoring-contract.ts#L284-L320","documentation":"Contract validation error from normalizeCompanyImportRow: the JSON serialization of the fully normalized row exceeds maxImportRowBytes in UTF-8 bytes. The check runs after normalization, so dedup/sorting overhead counts — the row is simply too large to persist as one import row.","triggerScenarios":"Thrown at shared/company-monitoring-contract.ts:302 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Trim large text fields (aliases, identifiers, locations) from the row","Split the company's data across fewer, tighter fields or raise the issue if the limit is too small for legitimate data"],"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"}