{"record":{"id":"23a41a3048279bfd","repo":"koala73/worldmonitor","slug":"field-is-required","errorCode":null,"errorMessage":"${field} is required","messagePattern":"(.+?) is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"shared/company-monitoring-contract.ts","lineNumber":84,"sourceCode":"  claim: 'cm_claim_',\n  event: 'cm_event_',\n  impact: 'cm_impact_',\n  evidence: 'cm_evidence_',\n} as const;\nconst ULID = '[0-9A-HJKMNP-TV-Z]{26}';\n\nconst encoder = new TextEncoder();\n\nfunction utf8Bytes(value: string): number {\n  return encoder.encode(value).byteLength;\n}\n\nfunction assertPlainText(value: unknown, field: string, maxBytes: number): string {\n  if (typeof value !== 'string') throw new Error(`${field} must be a string`);\n  const unicodeNormalized = value.normalize('NFC');\n  if (CONTROL_CHARACTERS.test(unicodeNormalized)) throw new Error(`${field} contains control characters`);\n  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`);","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/shared/company-monitoring-contract.ts#L66-L102","documentation":"Contract validation error from assertPlainText: the named field is empty after NFC normalization, whitespace collapsing, and trimming. It is a required-field guard — the caller sent an all-whitespace or empty string where a non-empty value is mandatory.","triggerScenarios":"Thrown at shared/company-monitoring-contract.ts:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide actual non-whitespace content for the field","Fix client UI that allows submitting blank values"],"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"}