paperclipai/paperclip · error · Error

${flag} requires a comma-separated value

Error message

${flag} requires a comma-separated value

What it means

selectorValues scans process.argv for a repeated flag (e.g. --candidate, --profile-family) and requires each occurrence to be followed by a value. If the next argument is missing or itself starts with `--`, it throws this error. Values are comma-separated strings collected per flag occurrence plus an optional env fallback.

Source

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

);
const seed =
  process.env.PAPERCLIP_EVAL_SCHEDULE_SEED ?? "runner-live-seven-week-v1";
const outputDirectory = resolve(
  packageRoot,
  ".paperclip-local/evals/workflows",
);
const historyDirectory = resolve(
  process.env.PAPERCLIP_EVAL_HISTORY_DIR ?? resolve(outputDirectory, "history"),
);
await mkdir(outputDirectory, { recursive: true });

function selectorValues(flag, environmentName) {
  const values = [];
  for (let index = 0; index < process.argv.length; index += 1) {
    if (process.argv[index] !== flag) continue;
    const value = process.argv[index + 1];
    if (!value || value.startsWith("--")) {
      throw new Error(`${flag} requires a comma-separated value`);
    }
    values.push(value);
  }
  if (process.env[environmentName]) values.push(process.env[environmentName]);
  return [
    ...new Set(
      values.flatMap((value) =>
        value
          .split(",")
          .map((entry) => entry.trim())
          .filter(Boolean),
      ),
    ),
  ];
}

function selectionLimit() {
  const index = process.argv.indexOf("--limit");

View on GitHub (pinned to 01ad858492)

Solutions

  1. Provide the value immediately after the flag: `--candidate id1,id2`.
  2. Repeat the flag for multiple groups rather than nesting flags: `--candidate a --candidate b`.
  3. Ensure the value does not begin with `--`; quote values that might.

Example fix

// before
node run-runner-live-eval-schedule.mjs --candidate --limit 3
// after
node run-runner-live-eval-schedule.mjs --candidate runner-acpx-claude --limit 3
Defensive patterns

Strategy: validation

Validate before calling

const i = argv.indexOf('--candidate');
if (i !== -1 && (!argv[i+1] || argv[i+1].startsWith('--'))) throw new Error('--candidate needs a value');

Prevention

When it happens

Trigger: `--candidate` as the last argument, `--candidate --limit 5` (next token is a flag), or `--candidate` followed by nothing after shell quoting strips the value.

Common situations: Empty quoted value "" being dropped or passed as flag-adjacent, reordering flags so one selector flag directly precedes another, forgetting the comma-separated list.

Understand the failure class

Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.

Related errors


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