{"record":{"id":"3478b711c7840892","repo":"paperclipai/paperclip","slug":"limit-must-be-a-positive-integer-3478b7","errorCode":null,"errorMessage":"--limit must be a positive integer","messagePattern":"--limit must be a positive integer","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/scripts/run-runner-live-eval-schedule.mjs","lineNumber":69,"sourceCode":"    ...new Set(\n      values.flatMap((value) =>\n        value\n          .split(\",\")\n          .map((entry) => entry.trim())\n          .filter(Boolean),\n      ),\n    ),\n  ];\n}\n\nfunction selectionLimit() {\n  const index = process.argv.indexOf(\"--limit\");\n  const raw =\n    index < 0 ? process.env.PAPERCLIP_EVAL_LIMIT : process.argv[index + 1];\n  if (raw === undefined || raw === \"\") return undefined;\n  const value = Number(raw);\n  if (!Number.isSafeInteger(value) || value <= 0) {\n    throw new Error(\"--limit must be a positive integer\");\n  }\n  return value;\n}\n\nconst selection = {\n  candidateIds: selectorValues(\"--candidate\", \"PAPERCLIP_EVAL_CANDIDATE\"),\n  caseIds: selectorValues(\"--case\", \"PAPERCLIP_EVAL_CASE\"),\n  limit: selectionLimit(),\n};\nconst selectionActive =\n  selection.candidateIds.length > 0 ||\n  selection.caseIds.length > 0 ||\n  selection.limit !== undefined;\n\nfunction safeBundleId(schedule) {\n  const runnerBuild =\n    process.env.PAPERCLIP_EVAL_RUNNER_BUILD ?? packageManifest.version;\n  const identity = JSON.stringify({","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/scripts/run-runner-live-eval-schedule.mjs#L51-L87","documentation":"selectionLimit reads --limit (or PAPERCLIP_EVAL_LIMIT env) and validates it is a positive safe integer before applying it to the selection. If the raw value parses to a non-integer, zero, negative, or non-numeric number, it throws this error. Absent or empty values are allowed and mean 'no limit'.","triggerScenarios":"`--limit 0`, `--limit -1`, `--limit abc`, `--limit 2.5`, or PAPERCLIP_EVAL_LIMIT set to a non-positive/non-numeric value; also `--limit` followed by a flag so Number(flag) is NaN.","commonSituations":"Typing a fractional or negative limit, setting PAPERCLIP_EVAL_LIMIT in CI to an empty-ish garbage string, forgetting that 0 is invalid here (it means 'no selection').","solutions":["Pass a positive integer: `--limit 5`.","Remove --limit (or unset PAPERCLIP_EVAL_LIMIT) to select without a cap.","Fix the env value if PAPERCLIP_EVAL_LIMIT contains invalid text; the env fallback is used when --limit is absent."],"exampleFix":"// before\nnode run-runner-live-eval-schedule.mjs --limit 0\n// after\nnode run-runner-live-eval-schedule.mjs --limit 10","handlingStrategy":"validation","validationCode":"const raw = process.env.PAPERCLIP_EVAL_LIMIT;\nif (raw !== undefined && raw !== '') { const v = Number(raw); if (!Number.isSafeInteger(v) || v <= 0) throw new Error('PAPERCLIP_EVAL_LIMIT must be a positive integer'); }","typeGuard":null,"tryCatchPattern":"try { runSchedule(); } catch (e) { if (e.message === '--limit must be a positive integer') { console.error('use a positive integer or omit --limit'); } else throw e; }","preventionTips":["Pass whole positive integers only","Validate PAPERCLIP_EVAL_LIMIT in CI config","Omit the flag when no cap is needed"],"tags":["cli","validation","numeric","eval-schedule"],"backgroundTag":"invalid-argument-value","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}