{"record":{"id":"3672aa73d5ab8951","repo":"jackwener/OpenCLI","slug":"invalid-limit","errorCode":"INVALID_LIMIT","errorMessage":"${payload.message || 'huodongxing limit must be a positive integer <= 50'}","messagePattern":"\\$\\{payload\\.message \\|\\| 'huodongxing limit must be a positive integer <= 50'\\}","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/huodongxing/events.js","lineNumber":297,"sourceCode":"    throw new CommandExecutionError(\n      'huodongxing events returned malformed extraction rows',\n      'Expected browser extraction payload rows to be an array.',\n    );\n  }\n  if (payload?.code === 'RATE_LIMIT') {\n    throw new CommandExecutionError(\n      payload.message || 'huodongxing events was rate limited by www.huodongxing.com',\n      payload.hint || 'Wait a few minutes and retry from a real browser session.',\n    );\n  }\n  if (payload?.code === 'TRANSIENT_ACCESS') {\n    throw new CommandExecutionError(\n      payload.message || 'huodongxing events page returned a temporary busy/access page',\n      payload.hint || 'Wait and retry from the same browser session.',\n    );\n  }\n  if (payload?.code === 'INVALID_LIMIT') {\n    throw new ArgumentError(payload.message || 'huodongxing limit must be a positive integer <= 50');\n  }\n  if (payload?.code === 'EMPTY_RESULT') {\n    throw new EmptyResultError(\n      'huodongxing events',\n      payload.hint || 'No Huodongxing event cards were found. The page may be empty.',\n    );\n  }\n  throw new CommandExecutionError(\n    payload?.message || 'huodongxing events returned malformed extraction data',\n    payload?.hint || 'Huodongxing extraction did not return the expected structured payload.',\n  );\n}\n\nexport function extractEventRows(limit = 20) {\n  return requireExtractionRows(extractEventRowsPayload(limit));\n}\n\nasync function extractEventRowsFromPage(page, limit) {","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/huodongxing/events.js#L279-L315","documentation":"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.","triggerScenarios":"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'.","commonSituations":"Passing a string like '100' or 'all'; misconfigured tooling default; assuming unlimited page size.","solutions":["Set limit to an integer between 1 and 50","Clamp/validate limit client-side before invoking the command","Omit limit to use the default (20)"],"exampleFix":"// before\nextractEventRows(100);\n// after\nextractEventRows(Math.min(Math.max(Number(limit) || 20, 1), 50));","handlingStrategy":"validation","validationCode":"const n = Number(limit ?? 20);\nif (!Number.isInteger(n) || n < 1 || n > 50) throw new Error('limit must be an integer 1..50');","typeGuard":"const isValidLimit = v => { const n = Number(v); return Number.isInteger(n) && n >= 1 && n <= 50; };","tryCatchPattern":"try { const rows = extractEventRows(limit); } catch (e) { if (e instanceof ArgumentError && /limit/.test(e.message)) return extractEventRows(20); throw e; }","preventionTips":["Clamp limit to 1–50 before every call","Never pass strings like 'all' or '0'","Default to 20 when the caller omits limit"],"tags":["argument-validation","pagination","limit"],"backgroundTag":"invalid-pagination-limit","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}