jackwener/OpenCLI · error · ArgumentError

dblp paper key "${value}" is not a valid record key

Error message

dblp paper key "${value}" is not a valid record key

What it means

Thrown by requireRecordKey when the supplied key does not match KEY_PATTERN (/^[a-z]+(\/[A-Za-z0-9_.-]+)+$/) — dblp record keys must look like <type>/<venue>/<short>. Failing this check locally avoids a guaranteed 404 from dblp.

Source

Thrown at clis/dblp/utils.js:118

    }
    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)));
}

/** Strip dblp's per-author homonym suffixes (`Smith 0001`) → `Smith`. */

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Copy the key from the `key` column of `dblp search` output rather than the URL
  2. Strip any URL/https://dblp.org/rec/ prefix and .html/.xml suffix, keeping the bare key
  3. Ensure the key has at least one slash and only letters/digits/_/./- in segments
  4. Verify against the pattern: e.g. journals/corr/abs-2509-05821 or phd/Smith20

Example fix

// before
node cli.js dblp paper "https://dblp.org/rec/conf/nips/VaswaniSPUJGKP17.html"
// after
node cli.js dblp paper "conf/nips/VaswaniSPUJGKP17"
Defensive patterns

Strategy: validation

Validate before calling

const KEY_PATTERN = /^[a-z]+(?:\/[A-Za-z0-9_.-]+)+$/;
function normalizeKey(input) {
  return String(input)
    .replace(/^https?:\/\/dblp\.org\/rec\//, '')
    .replace(/\.(html|xml|json)$/, '')
    .trim();
}
const key = normalizeKey(raw);
if (!KEY_PATTERN.test(key)) throw new Error(`Invalid dblp key: "${raw}" — expected e.g. conf/nips/VaswaniSPUJGKP17`);

Type guard

function isValidRecordKey(v) { return typeof v === 'string' && /^[a-z]+(?:\/[A-Za-z0-9_.-]+)+$/.test(v.trim()); }

Try / catch

try {
  const row = await dblpPaper(rawKey);
} catch (err) {
  if (/not a valid record key/.test(err.message)) {
    console.error('Copy the bare key (e.g. conf/nips/VaswaniSPUJGKP17) from the `key` column of `dblp search`');
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Passing a full dblp URL instead of the bare key, a DOI, a title, a key with spaces or invalid characters, or a key missing the slash-separated segments.

Common situations: Pasting https://dblp.org/rec/conf/nips/... instead of conf/nips/VaswaniSPUJGKP17; passing a DOI like 10.1145/...; typos or trailing slashes in copied keys.

Related errors


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