koala73/worldmonitor · error · Error
company claim is required
Error message
company claim is required
What it means
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.
Source
Thrown at shared/company-monitoring-contract.ts:170
COMPANY_CLAIM_TYPE_LEGAL_IDENTIFIER: 'legal_identifier',
COMPANY_CLAIM_TYPE_X_ACCOUNT_ID: 'x_account_id',
COMPANY_CLAIM_TYPE_X_HANDLE: 'x_handle',
COMPANY_CLAIM_TYPE_LOCATION: 'location',
COMPANY_CLAIM_TYPE_CUSTOMER_REFERENCE: 'customer_reference',
};
export interface CompanyClaimInput {
type: string;
value: string;
}
export interface NormalizedCompanyClaimInput {
type: CompanyClaimType;
value: string;
}
export function normalizeCompanyClaimInput(input: CompanyClaimInput): NormalizedCompanyClaimInput {
if (!input || typeof input !== 'object') throw new Error('company claim is required');
// Own-property lookup: a plain object literal inherits `__proto__`, `constructor`,
// `toString`, etc., and a truthiness check would let those through as a "valid" type.
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;View on GitHub (pinned to eeab0a219f)
Solutions
- Send the claim as a JSON object with 'type' and 'value' string properties
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shared/company-monitoring-contract.ts:170 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/567e3c2865248565.
Report an issue: GitHub.