jackwener/OpenCLI · error · CliError

ARGUMENT

ARGUMENT

Error message

A review token is required.

What it means

The paperreview `feedback` command requires a review token to identify which review to update. The CLI validates kwargs.token before doing any work and throws CliError with code ARGUMENT when it is missing or blank. This is a deliberate pre-flight argument check, not a server error.

Source

Thrown at clis/paperreview/feedback.js:24

    name: 'feedback',
    access: 'write',
    description: 'Submit feedback for a paperreview.ai review token',
    domain: PAPERREVIEW_DOMAIN,
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'token', positional: true, required: true, help: 'Review token returned by paperreview.ai' },
        { name: 'helpfulness', required: true, type: 'int', help: 'Helpfulness score from 1 to 5' },
        { name: 'critical-error', required: true, choices: ['yes', 'no'], help: 'Whether the review contains a critical error' },
        { name: 'actionable-suggestions', required: true, choices: ['yes', 'no'], help: 'Whether the review contains actionable suggestions' },
        { name: 'additional-comments', help: 'Optional free-text feedback' },
        { name: 'timeout', type: 'int', required: false, default: 30, help: 'Max seconds for the overall command (default: 30)' },
    ],
    columns: ['status', 'token', 'helpfulness', 'critical_error', 'actionable_suggestions', 'message'],
    func: async (kwargs) => {
        const token = String(kwargs.token ?? '').trim();
        if (!token) {
            throw new CliError('ARGUMENT', 'A review token is required.');
        }
        const helpfulness = validateHelpfulness(kwargs.helpfulness);
        const criticalError = parseYesNo(kwargs['critical-error'], 'critical-error');
        const actionableSuggestions = parseYesNo(kwargs['actionable-suggestions'], 'actionable-suggestions');
        const comments = String(kwargs['additional-comments'] ?? '').trim();
        const payload = {
            helpfulness,
            has_critical_error: criticalError,
            has_actionable_suggestions: actionableSuggestions,
        };
        if (comments) {
            payload.additional_comments = comments;
        }
        const { response, payload: responsePayload } = await requestJson(`/api/feedback/${encodeURIComponent(token)}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify(payload),
        });

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the command with --token <your-review-token>.
  2. In scripts, verify the token variable is non-empty before invoking the CLI.
  3. Retrieve the token from the original review request output if lost.

Example fix

// before
cli feedback --critical-error no
// after
cli feedback --token abc123 --critical-error no
Defensive patterns

Strategy: validation

Validate before calling

const token = process.env.REVIEW_TOKEN;
if (!token || !token.trim()) {
  throw new Error('Set --token or REVIEW_TOKEN before running feedback');
}

Type guard

function hasToken(v) {
  return typeof v === 'string' && v.trim().length > 0;
}

Try / catch

try {
  await cli.feedback({ token: '' });
} catch (err) {
  if (err.code === 'ARGUMENT') console.error('Missing --token; get it from your review request');
  else throw err;
}

Prevention

When it happens

Trigger: Running the feedback command without --token, or with an empty/whitespace-only value (e.g. --token "").

Common situations: Copy-pasting a command and losing the token argument; scripting the command with an unset shell variable (e.g. --token "$REVIEW_TOKEN" when the var is empty).

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/225488806455599e. Report an issue: GitHub.