jackwener/OpenCLI · error · ArgumentError

INVALID_LIMIT

INVALID_LIMIT

Error message

${payload.message || 'huodongxing limit must be a positive integer <= 50'}

What it means

The extractor returned code 'INVALID_LIMIT', meaning the requested page-size limit was rejected. requireExtractionRows maps it to an ArgumentError with a default message stating limit must be a positive integer <= 50.

Source

Thrown at clis/huodongxing/events.js:297

    throw new CommandExecutionError(
      'huodongxing events returned malformed extraction rows',
      'Expected browser extraction payload rows to be an array.',
    );
  }
  if (payload?.code === 'RATE_LIMIT') {
    throw new CommandExecutionError(
      payload.message || 'huodongxing events was rate limited by www.huodongxing.com',
      payload.hint || 'Wait a few minutes and retry from a real browser session.',
    );
  }
  if (payload?.code === 'TRANSIENT_ACCESS') {
    throw new CommandExecutionError(
      payload.message || 'huodongxing events page returned a temporary busy/access page',
      payload.hint || 'Wait and retry from the same browser session.',
    );
  }
  if (payload?.code === 'INVALID_LIMIT') {
    throw new ArgumentError(payload.message || 'huodongxing limit must be a positive integer <= 50');
  }
  if (payload?.code === 'EMPTY_RESULT') {
    throw new EmptyResultError(
      'huodongxing events',
      payload.hint || 'No Huodongxing event cards were found. The page may be empty.',
    );
  }
  throw new CommandExecutionError(
    payload?.message || 'huodongxing events returned malformed extraction data',
    payload?.hint || 'Huodongxing extraction did not return the expected structured payload.',
  );
}

export function extractEventRows(limit = 20) {
  return requireExtractionRows(extractEventRowsPayload(limit));
}

async function extractEventRowsFromPage(page, limit) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Set limit to an integer between 1 and 50
  2. Clamp/validate limit client-side before invoking the command
  3. Omit limit to use the default (20)

Example fix

// before
extractEventRows(100);
// after
extractEventRows(Math.min(Math.max(Number(limit) || 20, 1), 50));
Defensive patterns

Strategy: validation

Validate before calling

const n = Number(limit ?? 20);
if (!Number.isInteger(n) || n < 1 || n > 50) throw new Error('limit must be an integer 1..50');

Type guard

const isValidLimit = v => { const n = Number(v); return Number.isInteger(n) && n >= 1 && n <= 50; };

Try / catch

try { const rows = extractEventRows(limit); } catch (e) { if (e instanceof ArgumentError && /limit/.test(e.message)) return extractEventRows(20); throw e; }

Prevention

When it happens

Trigger: Calling events with a limit of 0, negative, non-integer, or greater than 50 that reaches the site and is bounced back with code: 'INVALID_LIMIT'.

Common situations: Passing a string like '100' or 'all'; misconfigured tooling default; assuming unlimited page size.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/3672aa73d5ab8951. Report an issue: GitHub.