jackwener/OpenCLI · error · CliError

ARGUMENT

ARGUMENT

Error message

"${name}" must be either "yes" or "no".

What it means

parseYesNo converts CLI yes/no flags into booleans and throws CliError (code ARGUMENT) for any other value. Flags like --critical-error, --actionable-suggestions must literally be "yes" or "no" (case-insensitive). This keeps tri-state flags strict rather than guessing at truthy strings.

Source

Thrown at clis/paperreview/utils.js:37

            return detail;
        if (message)
            return message;
        if (error)
            return error;
    }
    const text = trimOrEmpty(payload);
    return text || fallback;
}
export function buildReviewUrl(token) {
    return `${PAPERREVIEW_BASE_URL}/review?token=${encodeURIComponent(token)}`;
}
export function parseYesNo(value, name) {
    const normalized = trimOrEmpty(value).toLowerCase();
    if (normalized === 'yes')
        return true;
    if (normalized === 'no')
        return false;
    throw new CliError('ARGUMENT', `"${name}" must be either "yes" or "no".`);
}
export function normalizeVenue(value) {
    return trimOrEmpty(value);
}
export function validateHelpfulness(value) {
    const numeric = Number(value);
    if (!Number.isInteger(numeric) || numeric < 1 || numeric > 5) {
        throw new CliError('ARGUMENT', '"helpfulness" must be an integer from 1 to 5.');
    }
    return numeric;
}
export async function readPdfFile(inputPath) {
    const rawPath = trimOrEmpty(inputPath);
    if (!rawPath) {
        throw new CliError('ARGUMENT', 'A PDF path is required.', 'Provide a local PDF file path');
    }
    const resolvedPath = path.resolve(rawPath);
    const fileName = path.basename(resolvedPath);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass exactly yes or no (any casing): --critical-error yes.
  2. Replace true/false or 1/0 with yes/no in scripts.
  3. Normalize values in wrapper scripts before forwarding to the CLI.

Example fix

// before
cli feedback --token t --critical-error true
// after
cli feedback --token t --critical-error yes
Defensive patterns

Strategy: validation

Validate before calling

function toYesNo(v) {
  const n = String(v ?? '').trim().toLowerCase();
  if (n !== 'yes' && n !== 'no') throw new Error(`"${v}" must be yes or no`);
  return n;
}

Type guard

function isYesNo(v) {
  const n = String(v ?? '').trim().toLowerCase();
  return n === 'yes' || n === 'no';
}

Try / catch

try {
  await cli.feedback({ 'critical-error': 'true' });
} catch (err) {
  if (err.code === 'ARGUMENT' && /yes.*no/.test(err.message)) console.error('Use --critical-error yes|no (not true/false)');
  else throw err;
}

Prevention

When it happens

Trigger: Passing --critical-error true/false, 1/0, y/n, or any value other than yes/no (case-insensitive after trim/lowercase).

Common situations: Users accustomed to boolean CLI conventions passing "true"; scripts interpolating 0/1 from config files; locale-mixed casing is fine (lowercased) but typos like "yes." fail.

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 jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/80556ec8e6e46b41. Report an issue: GitHub.