koala73/worldmonitor · error · Error
ordinal must be between 0 and 99
Error message
ordinal must be between 0 and 99
What it means
Contract validation error from normalizeCompanyImportRow: input.ordinal is not a safe integer in [0, maxImportRows). The ordinal preserves row order within a batch and doubles as a bound on batch size (currently 100 rows, 0–99).
Source
Thrown at shared/company-monitoring-contract.ts:291
const customerReference = normalizeOptionalText(
input.customerReference,
'customerReference',
COMPANY_MONITORING_LIMITS.maxCustomerReferenceBytes,
);
if (customerReference !== undefined) normalized.customerReference = customerReference;
return normalized;
}
export function normalizeCompanyImportRow(input: CompanyImportRowInput): NormalizedCompanyImportRow {
if (!input || typeof input !== 'object') throw new Error('import row is required');
const clientImportId = assertPlainText(
input.clientImportId,
'clientImportId',
COMPANY_MONITORING_LIMITS.maxClientImportIdBytes,
);
if (!Number.isSafeInteger(input.ordinal) || input.ordinal < 0 || input.ordinal >= COMPANY_MONITORING_LIMITS.maxImportRows) {
throw new Error('ordinal must be between 0 and 99');
}
const normalized: NormalizedCompanyImportRow = {
contractVersion: COMPANY_MONITORING_IMPORT_VERSION,
clientImportId,
ordinal: input.ordinal,
...normalizeMonitoredCompanyInput(input),
};
if (utf8Bytes(JSON.stringify(normalized)) > COMPANY_MONITORING_LIMITS.maxImportRowBytes) {
throw new Error(`row exceeds ${COMPANY_MONITORING_LIMITS.maxImportRowBytes} bytes`);
}
return normalized;
}
export function normalizeCompanyImportBatch(inputs: CompanyImportRowInput[]): NormalizedCompanyImportRow[] {
if (!Array.isArray(inputs)) throw new Error('import batch must be a list');
if (inputs.length === 0) throw new Error('import batch requires at least one row');View on GitHub (pinned to eeab0a219f)
Solutions
- Assign each row a unique integer ordinal starting at 0
- Split larger imports into multiple batches of at most 100 rows
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shared/company-monitoring-contract.ts:291 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/9c294703543ba319.
Report an issue: GitHub.