paperclipai/paperclip · error · Error

--limit must be a positive integer

Error message

--limit must be a positive integer

What it means

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'.

Source

Thrown at packages/paperclip-runner/scripts/run-runner-live-eval-schedule.mjs:69

    ...new Set(
      values.flatMap((value) =>
        value
          .split(",")
          .map((entry) => entry.trim())
          .filter(Boolean),
      ),
    ),
  ];
}

function selectionLimit() {
  const index = process.argv.indexOf("--limit");
  const raw =
    index < 0 ? process.env.PAPERCLIP_EVAL_LIMIT : process.argv[index + 1];
  if (raw === undefined || raw === "") return undefined;
  const value = Number(raw);
  if (!Number.isSafeInteger(value) || value <= 0) {
    throw new Error("--limit must be a positive integer");
  }
  return value;
}

const selection = {
  candidateIds: selectorValues("--candidate", "PAPERCLIP_EVAL_CANDIDATE"),
  caseIds: selectorValues("--case", "PAPERCLIP_EVAL_CASE"),
  limit: selectionLimit(),
};
const selectionActive =
  selection.candidateIds.length > 0 ||
  selection.caseIds.length > 0 ||
  selection.limit !== undefined;

function safeBundleId(schedule) {
  const runnerBuild =
    process.env.PAPERCLIP_EVAL_RUNNER_BUILD ?? packageManifest.version;
  const identity = JSON.stringify({

View on GitHub (pinned to 01ad858492)

Solutions

  1. Pass a positive integer: `--limit 5`.
  2. Remove --limit (or unset PAPERCLIP_EVAL_LIMIT) to select without a cap.
  3. Fix the env value if PAPERCLIP_EVAL_LIMIT contains invalid text; the env fallback is used when --limit is absent.

Example fix

// before
node run-runner-live-eval-schedule.mjs --limit 0
// after
node run-runner-live-eval-schedule.mjs --limit 10
Defensive patterns

Strategy: validation

Validate before calling

const raw = process.env.PAPERCLIP_EVAL_LIMIT;
if (raw !== undefined && raw !== '') { const v = Number(raw); if (!Number.isSafeInteger(v) || v <= 0) throw new Error('PAPERCLIP_EVAL_LIMIT must be a positive integer'); }

Try / catch

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; }

Prevention

When it happens

Trigger: `--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.

Common situations: 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').

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10). Data as JSON: /api/errors/3478b711c7840892. Report an issue: GitHub.