paperclipai/paperclip · error · Error

Missing ${name}

Error message

Missing ${name}

What it means

The script's CLI entry point defines arg(name) to read required command-line flags, throwing `Missing ${name}` when the flag is absent or has no value. This error means a required argument (e.g. --source, --evals-root, --output, --revision) was not supplied or was given with an empty next token.

Source

Thrown at packages/paperclip-runner/scripts/refresh-runner-protocol-eval-report.mjs:94

      providerCalls: 0,
    },
  };
  await writeFile(
    join(reportRoot, "campaign.json"),
    `${JSON.stringify(refreshed, null, 2)}\n`,
  );
  await validatePublicProtocolEvalReport(reportRoot, { viewerRoot });
  return { reportRoot, campaignId: refreshed.campaignId, providerCalls: 0 };
}

if (
  process.argv[1] &&
  resolve(process.argv[1]) === resolve(import.meta.filename)
) {
  const arg = (name) => {
    const index = process.argv.indexOf(name);
    if (index < 0 || !process.argv[index + 1])
      throw new Error(`Missing ${name}`);
    return process.argv[index + 1];
  };
  console.log(
    await refreshProtocolEvalReport({
      sourceRoot: resolve(arg("--source")),
      evalsRoot: resolve(arg("--evals-root")),
      viewerRoot: resolve(arg("--viewer-root")),
      outputRoot: resolve(arg("--output")),
      revision: arg("--revision"),
    }),
  );
}

View on GitHub (pinned to 01ad858492)

Solutions

  1. Add the missing flag with a value, e.g. --source /path/to/campaign
  2. Check the exact flag name spelling required by the script (see its main block)
  3. In CI, ensure the workflow step passes all required args and the shell variables are set
  4. Wrap the invocation to echo process.argv when debugging which flag is missing

Example fix

// before
node refresh-runner-protocol-eval-report.mjs --output out/x --revision r1
// after
node refresh-runner-protocol-eval-report.mjs --source ./campaign --evals-root ./evals --output out/x --revision r1
Defensive patterns

Strategy: validation

Validate before calling

for (const f of ['--source','--evals-root','--output','--revision']) if (!process.argv.includes(f)) throw new Error('Missing ' + f);

Type guard

null

Try / catch

try { await main(); } catch (e) { if (e.message.startsWith('Missing ')) { console.error(e.message + ' — see script usage'); process.exit(2); } throw e; }

Prevention

When it happens

Trigger: Running the script directly with a missing required flag, or `--source` as the last argument with no value after it; invoking via npm script that drops an argument.

Common situations: Copy-pasting an older invocation from docs that lacked a newly added required flag; CI workflow step missing an `args:` entry; shell variable expansion emptying a flag's value (`--source $UNSET_VAR`).

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


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