{"record":{"id":"96381af51a7954e0","repo":"jackwener/OpenCLI","slug":"limit-must-be-an-integer-between-min-limit-an-96381a","errorCode":null,"errorMessage":"--limit must be an integer between ${MIN_LIMIT} and ${MAX_LIMIT}","messagePattern":"--limit must be an integer between (.+?) and (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/inbox.js","lineNumber":161,"sourceCode":"  ],\n  columns: [\n    'rank',\n    'thread_url',\n    'thread_id',\n    'person_name',\n    'last_message_preview',\n    'unread',\n    'counterparty_type',\n    'category',\n    'timestamp',\n  ],\n  func: async (page, kwargs) => {\n    // Validate --limit explicitly rather than silently clamping an out-of-range value.\n    let limit = DEFAULT_LIMIT;\n    if (kwargs.limit !== undefined && kwargs.limit !== null && kwargs.limit !== '') {\n      limit = Number(kwargs.limit);\n      if (!Number.isInteger(limit) || limit < MIN_LIMIT || limit > MAX_LIMIT) {\n        throw new ArgumentError(`--limit must be an integer between ${MIN_LIMIT} and ${MAX_LIMIT}`);\n      }\n    }\n    const unreadOnly = Boolean(kwargs['unread-only']);\n\n    await page.goto(MESSAGING_URL);\n    await page.wait(10);\n\n    // Locate the messaging API request the page fired on load; retry once if the\n    // SPA was slow to issue it.\n    let located = unwrapEvaluateResult(await page.evaluate(`(${findMessagingApiUrl.toString()})()`));\n    if (located && located.loginRequired) {\n      throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn requires an active signed-in browser session.');\n    }\n    if (!located || !located.url) {\n      await page.wait(6);\n      located = unwrapEvaluateResult(await page.evaluate(`(${findMessagingApiUrl.toString()})()`));\n    }\n    if (!located || !located.url) {","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/inbox.js#L143-L179","documentation":"The `linkedin inbox` command validates `--limit` explicitly instead of silently clamping. If the value is provided but is not an integer (or not parseable as one) or falls outside [MIN_LIMIT, MAX_LIMIT], an ArgumentError is thrown before any navigation happens. This is fail-fast input validation so out-of-range requests are surfaced rather than quietly altered.","triggerScenarios":"Running `linkedin inbox --limit abc` (Number() yields NaN), `--limit 3.5` (not an integer), `--limit 0` or a negative number below MIN_LIMIT, or a value above MAX_LIMIT — all when kwargs.limit is non-empty.","commonSituations":"Typos or shell quoting issues passing the flag, scripts computing a limit from a float, assuming 0 means 'unlimited' like other tools, or copying a page-size from another CLI whose bounds differ.","solutions":["Pass an integer value within the allowed MIN_LIMIT..MAX_LIMIT range, e.g. `linkedin inbox --limit 25`.","Check the command help/source for the exact MIN_LIMIT and MAX_LIMIT constants defined in clis/linkedin/inbox.js.","In scripts, coerce and floor the value first (e.g. Math.floor(Number(x))) and skip the flag to use DEFAULT_LIMIT when the value is empty."],"exampleFix":"// before\nlinkedin inbox --limit 500   // exceeds MAX_LIMIT -> ArgumentError\n\n// after\nlinkedin inbox --limit 50    // or omit --limit to use DEFAULT_LIMIT","handlingStrategy":"validation","validationCode":"const MIN_LIMIT = 1, MAX_LIMIT = 50; // check constants in clis/linkedin/inbox.js\nconst n = Number(rawLimit);\nif (rawLimit !== '' && rawLimit != null && (!Number.isInteger(n) || n < MIN_LIMIT || n > MAX_LIMIT)) {\n  throw new RangeError(`--limit must be an integer between ${MIN_LIMIT} and ${MAX_LIMIT}`);\n}","typeGuard":"const isValidLimit = (v) => Number.isInteger(Number(v)) && Number(v) >= MIN_LIMIT && Number(v) <= MAX_LIMIT;","tryCatchPattern":"try {\n  await linkedinInbox({ limit: rawLimit });\n} catch (e) {\n  if (e instanceof ArgumentError) {\n    console.error(`Bad --limit \"${rawLimit}\"; using default`);\n    return linkedinInbox({});\n  }\n  throw e;\n}","preventionTips":["Validate integer flags at the argument-parsing layer before they reach the command.","Reuse the library's MIN_LIMIT/MAX_LIMIT constants instead of hardcoding your own bounds.","Treat 0/'' as 'unset' and omit the flag to use DEFAULT_LIMIT."],"tags":["cli","argument-validation","linkedin"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}