jackwener/OpenCLI · error · ArgumentError

dblp paper key is required

Error message

dblp paper key is required

What it means

Thrown by requireRecordKey when the paper/record key argument is missing or empty. Fetching a specific dblp record requires its key (e.g. conf/nips/VaswaniSPUJGKP17).

Source

Thrown at clis/dblp/utils.js:115

    }
    if (n > maxValue) {
        throw new ArgumentError(`dblp ${label} must be <= ${maxValue}`);
    }
    return n;
}

export function requireQuery(value, label = 'query') {
    const q = String(value ?? '').trim();
    if (!q) {
        throw new ArgumentError(`dblp ${label} cannot be empty`);
    }
    return q;
}

export function requireRecordKey(value) {
    const key = String(value ?? '').trim();
    if (!key) {
        throw new ArgumentError('dblp paper key is required');
    }
    if (!KEY_PATTERN.test(key)) {
        throw new ArgumentError(`dblp paper key "${value}" is not a valid record key`, 'Expected something like "conf/nips/VaswaniSPUJGKP17" — copy the `key` column from `dblp search`.');
    }
    return key;
}

/** Decode the small set of XML entities dblp emits in record bodies. */
export function decodeXmlEntities(text) {
    if (!text) return '';
    return String(text)
        .replace(/&amp;/g, '&')
        .replace(/&lt;/g, '<')
        .replace(/&gt;/g, '>')
        .replace(/&apos;/g, "'")
        .replace(/&quot;/g, '"')
        .replace(/&#x([0-9a-fA-F]+);/g, (_, h) => String.fromCodePoint(parseInt(h, 16)))
        .replace(/&#(\d+);/g, (_, d) => String.fromCodePoint(parseInt(d, 10)));

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass the record key as the argument, e.g. dblp paper conf/nips/VaswaniSPUJGKP17
  2. Copy the key from the `key` column of a previous `dblp search`
  3. Check that the shell variable or pipe supplying the key is non-empty

Example fix

// before
node cli.js dblp paper
// after
node cli.js dblp paper conf/nips/VaswaniSPUJGKP17
Defensive patterns

Strategy: validation

Validate before calling

const key = (process.argv[3] ?? '').trim();
if (!key) {
  console.error('Usage: dblp paper <record-key>  e.g. conf/nips/VaswaniSPUJGKP17');
  process.exit(2);
}

Type guard

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

Try / catch

try {
  const row = await dblpPaper(rawKey);
} catch (err) {
  if (/paper key is required/.test(err.message)) {
    console.error('Pass a record key from `dblp search` (key column)');
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Running a dblp paper/record command with no key argument, an empty string, or a shell variable that expanded to nothing.

Common situations: Omitting the positional key; scripting with an unset variable; piping intended to supply the key that produced no input.

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/1d71db0f443554be. Report an issue: GitHub.