{"record":{"id":"567e3c2865248565","repo":"koala73/worldmonitor","slug":"company-claim-is-required","errorCode":null,"errorMessage":"company claim is required","messagePattern":"company claim is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"shared/company-monitoring-contract.ts","lineNumber":170,"sourceCode":"  COMPANY_CLAIM_TYPE_LEGAL_IDENTIFIER: 'legal_identifier',\n  COMPANY_CLAIM_TYPE_X_ACCOUNT_ID: 'x_account_id',\n  COMPANY_CLAIM_TYPE_X_HANDLE: 'x_handle',\n  COMPANY_CLAIM_TYPE_LOCATION: 'location',\n  COMPANY_CLAIM_TYPE_CUSTOMER_REFERENCE: 'customer_reference',\n};\n\nexport interface CompanyClaimInput {\n  type: string;\n  value: string;\n}\n\nexport interface NormalizedCompanyClaimInput {\n  type: CompanyClaimType;\n  value: string;\n}\n\nexport function normalizeCompanyClaimInput(input: CompanyClaimInput): NormalizedCompanyClaimInput {\n  if (!input || typeof input !== 'object') throw new Error('company claim is required');\n  // Own-property lookup: a plain object literal inherits `__proto__`, `constructor`,\n  // `toString`, etc., and a truthiness check would let those through as a \"valid\" type.\n  const type = Object.prototype.hasOwnProperty.call(COMPANY_CLAIM_TYPE_BY_INPUT, input.type)\n    ? COMPANY_CLAIM_TYPE_BY_INPUT[input.type]\n    : undefined;\n  if (!type) throw new Error('company claim type is invalid');\n\n  let value: string;\n  switch (type) {\n    case 'alias':\n      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxAliasBytes);\n      break;\n    case 'domain':\n      value = normalizeDomain(input.value, 0);\n      break;\n    case 'legal_identifier':\n      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxIdentifierBytes);\n      break;","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/shared/company-monitoring-contract.ts#L152-L188","documentation":"Contract validation error from normalizeCompanyClaimInput: the company claim argument is null, undefined, or not an object. It is a top-level shape guard before the claim's type and value are examined.","triggerScenarios":"Thrown at shared/company-monitoring-contract.ts:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send the claim as a JSON object with 'type' and 'value' string properties"],"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"}