{"record":{"id":"baf967de5ee206ad","repo":"koala73/worldmonitor","slug":"invalid-x-handle-handle","errorCode":null,"errorMessage":"invalid X handle: ${handle}","messagePattern":"invalid X handle: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"shared/company-monitoring-contract.ts","lineNumber":122,"sourceCode":"}\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,\n  ).replace(/^@/, '').toLowerCase();\n  if (!X_HANDLE.test(handle)) throw new Error(`invalid X handle: ${handle}`);\n  return handle;\n}\n\nconst DOMICILE_COUNTRY_BY_INPUT = {\n  US: 'US',\n  GB: 'GB',\n  DOMICILE_COUNTRY_US: 'US',\n  DOMICILE_COUNTRY_GB: 'GB',\n} as const;\n\nexport type CompanyClaimType =\n  | 'alias'\n  | 'domain'\n  | 'legal_identifier'\n  | 'x_account_id'\n  | 'x_handle'\n  | 'location'\n  | 'customer_reference';","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/shared/company-monitoring-contract.ts#L104-L140","documentation":"Contract validation error from normalizeXHandle: after stripping a leading '@' and lowercasing, the handle does not match the X_HANDLE pattern. The offending handle is included in the message. Inputs like full URLs, display names, or handles with invalid characters trigger this.","triggerScenarios":"Thrown at shared/company-monitoring-contract.ts:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send the bare handle (e.g. 'acme' or '@acme'; the @ is stripped automatically), not a full x.com URL","Remove spaces and characters disallowed in X handles"],"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"}