jackwener/OpenCLI · error · CliError

ARGUMENT

ARGUMENT

Error message

An email address is required.

What it means

The paperreview `submit` command needs an email address for the submission payload. The CLI trims kwargs.email and throws CliError with code ARGUMENT (with hint 'Pass --email <address>') when it is empty. The check happens after the PDF is read but before any submission proceeds.

Source

Thrown at clis/paperreview/submit.js:35

        { name: 'prepare-only', type: 'bool', default: false, help: 'Request an upload slot but stop before uploading the PDF' },
        { name: 'timeout', type: 'int', required: false, default: 120, help: 'Max seconds for the overall command (default: 120)' },
    ],
    columns: ['status', 'file', 'email', 'venue', 'token', 'review_url', 'message'],
    footerExtra: (kwargs) => {
        if (kwargs['dry-run'] === true)
            return 'dry run only';
        if (kwargs['prepare-only'] === true)
            return 'prepared only';
        return undefined;
    },
    func: async (kwargs) => {
        const pdfFile = await readPdfFile(kwargs.pdf);
        const email = String(kwargs.email ?? '').trim();
        const venue = normalizeVenue(kwargs.venue);
        const dryRun = kwargs['dry-run'] === true;
        const prepareOnly = kwargs['prepare-only'] === true;
        if (!email) {
            throw new CliError('ARGUMENT', 'An email address is required.', 'Pass --email <address>');
        }
        if (dryRun) {
            return summarizeSubmission({
                pdfFile,
                email,
                venue,
                message: 'Input validation passed. No remote request was sent.',
                dryRun: true,
            });
        }
        const { response: uploadUrlResponse, payload: uploadUrlPayload } = await requestJson('/api/get-upload-url', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({
                filename: pdfFile.fileName,
                venue,
            }),
        });

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run with --email you@example.com as the hint suggests.
  2. Validate the email variable in wrapper scripts before calling the CLI.
  3. Note email is required even for --dry-run/--prepare-only since it is part of the prepared payload.

Example fix

// before
cli submit --pdf paper.pdf
// after
cli submit --pdf paper.pdf --email author@example.com
Defensive patterns

Strategy: validation

Validate before calling

const email = process.env.SUBMIT_EMAIL;
if (!email || !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email.trim())) {
  throw new Error('Provide a valid --email address');
}

Type guard

function isEmail(v) {
  return typeof v === 'string' && /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v.trim());
}

Try / catch

try {
  await cli.submit({ pdf: pdfPath, email: '' });
} catch (err) {
  if (err.code === 'ARGUMENT' && /email/i.test(err.message)) console.error('Pass --email <address>');
  else throw err;
}

Prevention

When it happens

Trigger: Running submit without --email, or with an empty/whitespace-only value.

Common situations: Forgetting the flag on first use; scripts with unset EMAIL variables; confusing --dry-run/--prepare-only flows where email still must be supplied.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/e72dcefd9d1a3b0c. Report an issue: GitHub.