koala73/worldmonitor · error · Error

invalid X account ID

Error message

invalid X account ID

What it means

Contract validation error from normalizeCompanyClaimInput: the claim type resolved to 'x_account_id' but the value does not match the expected X account ID format. Each claim type has its own value validation; this is the x_account_id branch failing.

Source

Thrown at shared/company-monitoring-contract.ts:191

  const type = Object.prototype.hasOwnProperty.call(COMPANY_CLAIM_TYPE_BY_INPUT, input.type)
    ? COMPANY_CLAIM_TYPE_BY_INPUT[input.type]
    : undefined;
  if (!type) throw new Error('company claim type is invalid');

  let value: string;
  switch (type) {
    case 'alias':
      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxAliasBytes);
      break;
    case 'domain':
      value = normalizeDomain(input.value, 0);
      break;
    case 'legal_identifier':
      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxIdentifierBytes);
      break;
    case 'x_account_id':
      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxXAccountIdBytes);
      if (!X_ACCOUNT_ID.test(value)) throw new Error('invalid X account ID');
      break;
    case 'x_handle':
      value = normalizeXHandle(input.value, 0);
      break;
    case 'location':
      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxLocationBytes);
      break;
    case 'customer_reference':
      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxCustomerReferenceBytes);
      break;
  }
  return { type, value };
}

export interface MonitoredCompanyInput {
  name: string;
  domicileCountry: string;
  aliases?: string[];

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Send the numeric X account ID string in the expected canonical format
  2. Copy the ID directly from the platform rather than a display handle
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shared/company-monitoring-contract.ts:191 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21). Data as JSON: /api/errors/2185274765b7ef55. Report an issue: GitHub.